diff options
| author | Kyren223 <Kyren223@proton.me> | 2024-12-18 18:10:56 +0200 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2024-12-18 18:10:56 +0200 |
| commit | 438e887d6f9eb462280a22ec0d42aead7bbf1c07 (patch) | |
| tree | eff8dfcd142b08ea1f78454718f466a176489d87 /internal/client/ui/viminput | |
| parent | b50ef57f447021fb40450b0af9a8a239843774f7 (diff) | |
Fixed motion counts only going up to 9 in viminput
Diffstat (limited to 'internal/client/ui/viminput')
| -rw-r--r-- | internal/client/ui/viminput/viminput.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/internal/client/ui/viminput/viminput.go b/internal/client/ui/viminput/viminput.go index 850b9e3..18f4c89 100644 --- a/internal/client/ui/viminput/viminput.go +++ b/internal/client/ui/viminput/viminput.go @@ -418,15 +418,17 @@ func (m *Model) handleNormalModeKeys(key tea.KeyMsg) { return } + motion := key.String() + count := 1 - if m.count != NoCount { + if m.count != NoCount && (motion[0] < '0' || motion[0] > '9'){ count = m.count m.count = NoCount } shouldReturn := false for i := 0; i < count; i++ { - line, col := m.Motion(key.String()) + line, col := m.Motion(motion) if line != Unchanged { m.SetCursorLine(line) shouldReturn = true @@ -1621,7 +1623,8 @@ func (m *Model) handleVisualModeKeys(key tea.KeyMsg) { return } - if key.String() == "o" { + motion := key.String() + if motion == "o" { line, col := m.vline, m.vcol m.vline = m.cursorLine m.vcol = m.cursorColumn @@ -1631,12 +1634,11 @@ func (m *Model) handleVisualModeKeys(key tea.KeyMsg) { } count := 1 - if m.count != NoCount { + if m.count != NoCount && (motion[0] < '0' || motion[0] > '9'){ count = m.count m.count = NoCount } - motion := key.String() shouldReturn := false for i := 0; i < count; i++ { line, col := m.Motion(motion) @@ -1792,7 +1794,8 @@ func (m *Model) handleVisualLineModeKeys(key tea.KeyMsg) { return } - if key.String() == "o" { + motion := key.String() + if motion == "o" { line, col := m.vline, m.vcol m.vline = m.cursorLine m.vcol = m.cursorColumn @@ -1802,12 +1805,11 @@ func (m *Model) handleVisualLineModeKeys(key tea.KeyMsg) { } count := 1 - if m.count != NoCount { + if m.count != NoCount && (motion[0] < '0' || motion[0] > '9'){ count = m.count m.count = NoCount } - motion := key.String() shouldReturn := false for i := 0; i < count; i++ { line, col := m.Motion(motion) |
