Skip to content

Commit 3cbcdd9

Browse files
committed
chore(textinput): minor logic improvement with regard to cursors
1 parent bb1d1d2 commit 3cbcdd9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

textinput/textinput.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -666,11 +666,13 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
666666
if m.useVirtualCursor {
667667
m.virtualCursor, cmd = m.virtualCursor.Update(msg)
668668
cmds = append(cmds, cmd)
669-
}
670669

671-
if oldPos != m.pos && m.virtualCursor.Mode() == cursor.CursorBlink {
672-
m.virtualCursor.Blink = false
673-
cmds = append(cmds, m.virtualCursor.BlinkCmd())
670+
// If the cursor position changed, reset the blink state. This is a
671+
// small UX nuance that makes cursor movement obvious and feel snappy.
672+
if oldPos != m.pos && m.virtualCursor.Mode() == cursor.CursorBlink {
673+
m.virtualCursor.Blink = false
674+
cmds = append(cmds, m.virtualCursor.BlinkCmd())
675+
}
674676
}
675677

676678
m.handleOverflow()

0 commit comments

Comments
 (0)