From 10962af2f27b32606062562dd11bb2a8cc15b35a Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Tue, 1 Jun 2021 18:37:11 -0400 Subject: [PATCH] Textinput's focus method now returns a command to initiate cursor blink --- textinput/textinput.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/textinput/textinput.go b/textinput/textinput.go index 32ead78..f336386 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -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 // receive keyboard input and the cursor will be hidden. -func (m *Model) Focus() { +func (m *Model) Focus() tea.Cmd { m.focus = true 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