mirror of
https://github.com/Maks1mS/bubbles.git
synced 2025-03-14 04:53:43 +03:00
Textinput's focus method now returns a command to initiate cursor blink
This commit is contained in:
parent
5082ae6f31
commit
10962af2f2
@ -233,9 +233,14 @@ func (m Model) Focused() bool {
|
|||||||
|
|
||||||
// Focus sets the focus state on the model. When the model is in focus it can
|
// Focus sets the focus state on the model. When the model is in focus it can
|
||||||
// receive keyboard input and the cursor will be hidden.
|
// receive keyboard input and the cursor will be hidden.
|
||||||
func (m *Model) Focus() {
|
func (m *Model) Focus() tea.Cmd {
|
||||||
m.focus = true
|
m.focus = true
|
||||||
m.blink = m.cursorMode == CursorHide // show the cursor unless we've explicitly hidden it
|
m.blink = m.cursorMode == CursorHide // show the cursor unless we've explicitly hidden it
|
||||||
|
|
||||||
|
if m.cursorMode == CursorBlink && m.focus {
|
||||||
|
return m.blinkCmd()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Blur removes the focus state on the model. When the model is blurred it can
|
// Blur removes the focus state on the model. When the model is blurred it can
|
||||||
|
Loading…
Reference in New Issue
Block a user