Skip to content

Commit 10962af

Browse files
committed
Textinput's focus method now returns a command to initiate cursor blink
1 parent 5082ae6 commit 10962af

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

textinput/textinput.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,14 @@ func (m Model) Focused() bool {
233233

234234
// Focus sets the focus state on the model. When the model is in focus it can
235235
// receive keyboard input and the cursor will be hidden.
236-
func (m *Model) Focus() {
236+
func (m *Model) Focus() tea.Cmd {
237237
m.focus = true
238238
m.blink = m.cursorMode == CursorHide // show the cursor unless we've explicitly hidden it
239+
240+
if m.cursorMode == CursorBlink && m.focus {
241+
return m.blinkCmd()
242+
}
243+
return nil
239244
}
240245

241246
// Blur removes the focus state on the model. When the model is blurred it can

0 commit comments

Comments
 (0)