fix(textarea): suppress blink messages when real cursor is active

This commit is contained in:
Christian Rocha
2025-05-26 09:15:38 -04:00
parent b531de8f1c
commit bb1d1d275d
+11 -6
View File
@@ -1196,13 +1196,18 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
m.viewport = &vp m.viewport = &vp
cmds = append(cmds, cmd) cmds = append(cmds, cmd)
newRow, newCol := m.cursorLineNumber(), m.col if m.useVirtualCursor {
m.virtualCursor, cmd = m.virtualCursor.Update(msg) m.virtualCursor, cmd = m.virtualCursor.Update(msg)
if (newRow != oldRow || newCol != oldCol) && m.virtualCursor.Mode() == cursor.CursorBlink {
m.virtualCursor.Blink = false // If the cursor has moved, reset the blink state. This is a small UX
cmd = m.virtualCursor.BlinkCmd() // nuance that makes cursor movement obvious and feel snappy.
newRow, newCol := m.cursorLineNumber(), m.col
if (newRow != oldRow || newCol != oldCol) && m.virtualCursor.Mode() == cursor.CursorBlink {
m.virtualCursor.Blink = false
cmd = m.virtualCursor.BlinkCmd()
}
cmds = append(cmds, cmd)
} }
cmds = append(cmds, cmd)
m.repositionView() m.repositionView()