summaryrefslogtreecommitdiff
path: root/internal/client/ui
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2024-12-18 18:10:56 +0200
committerKyren223 <Kyren223@proton.me>2024-12-18 18:10:56 +0200
commit438e887d6f9eb462280a22ec0d42aead7bbf1c07 (patch)
treeeff8dfcd142b08ea1f78454718f466a176489d87 /internal/client/ui
parentb50ef57f447021fb40450b0af9a8a239843774f7 (diff)
Fixed motion counts only going up to 9 in viminput
Diffstat (limited to 'internal/client/ui')
-rw-r--r--internal/client/ui/core/chat/chat.go2
-rw-r--r--internal/client/ui/viminput/viminput.go18
2 files changed, 11 insertions, 9 deletions
diff --git a/internal/client/ui/core/chat/chat.go b/internal/client/ui/core/chat/chat.go
index 00f5837..181167f 100644
--- a/internal/client/ui/core/chat/chat.go
+++ b/internal/client/ui/core/chat/chat.go
@@ -15,7 +15,7 @@ type Model struct {
}
func New() Model {
- vi := viminput.New(90, 5)
+ vi := viminput.New(90, 20)
vi.Placeholder = "Send a message..."
vi.PlaceholderStyle = lipgloss.NewStyle().Foreground(colors.Gray)
vi.LineDecoration = func(lnum int, m viminput.Model) string {
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)