mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-16 01:43:21 +00:00
fix(textarea): suppress blink messages when real cursor is active
This commit is contained in:
+11
-6
@@ -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()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user