summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoradamdotdevin <[email protected]>2025-07-21 10:43:55 -0500
committeradamdotdevin <[email protected]>2025-07-21 10:44:21 -0500
commitd957ab849b362babbc8ccb82139a9c48734fe3d3 (patch)
tree44bc9d2a73d6efbf3703b0fc36f53f98759f52bd
parent4b2e52c834680301556ad103f7cd885071b8df6e (diff)
downloadopencode-d957ab849b362babbc8ccb82139a9c48734fe3d3.tar.gz
opencode-d957ab849b362babbc8ccb82139a9c48734fe3d3.zip
fix(tui): up/down arrow handling
-rw-r--r--packages/tui/internal/components/chat/editor.go8
-rw-r--r--packages/tui/internal/components/textarea/textarea.go12
2 files changed, 10 insertions, 10 deletions
diff --git a/packages/tui/internal/components/chat/editor.go b/packages/tui/internal/components/chat/editor.go
index e4e62ed7e..dbd4f3dbb 100644
--- a/packages/tui/internal/components/chat/editor.go
+++ b/packages/tui/internal/components/chat/editor.go
@@ -83,13 +83,13 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if m.historyIndex == -1 {
// Save current text before entering history
m.currentText = m.textarea.Value()
- m.textarea.CursorStart()
+ m.textarea.MoveToBegin()
}
// Move up in history (older messages)
if m.historyIndex < len(m.app.State.MessageHistory)-1 {
m.historyIndex++
m.RestoreFromHistory(m.historyIndex)
- m.textarea.CursorStart()
+ m.textarea.MoveToBegin()
}
return m, nil
}
@@ -105,11 +105,11 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.currentText = ""
} else {
m.RestoreFromHistory(m.historyIndex)
- m.textarea.CursorEnd()
+ m.textarea.MoveToEnd()
}
return m, nil
} else if m.historyIndex > -1 {
- m.textarea.CursorEnd()
+ m.textarea.MoveToEnd()
return m, nil
}
}
diff --git a/packages/tui/internal/components/textarea/textarea.go b/packages/tui/internal/components/textarea/textarea.go
index d97b8fdc7..60e72e09a 100644
--- a/packages/tui/internal/components/textarea/textarea.go
+++ b/packages/tui/internal/components/textarea/textarea.go
@@ -1430,14 +1430,14 @@ func (m Model) Width() int {
return m.width
}
-// moveToBegin moves the cursor to the beginning of the input.
-func (m *Model) moveToBegin() {
+// MoveToBegin moves the cursor to the beginning of the input.
+func (m *Model) MoveToBegin() {
m.row = 0
m.SetCursorColumn(0)
}
-// moveToEnd moves the cursor to the end of the input.
-func (m *Model) moveToEnd() {
+// MoveToEnd moves the cursor to the end of the input.
+func (m *Model) MoveToEnd() {
m.row = len(m.value) - 1
m.SetCursorColumn(len(m.value[m.row]))
}
@@ -1626,9 +1626,9 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
case key.Matches(msg, m.KeyMap.WordBackward):
m.wordLeft()
case key.Matches(msg, m.KeyMap.InputBegin):
- m.moveToBegin()
+ m.MoveToBegin()
case key.Matches(msg, m.KeyMap.InputEnd):
- m.moveToEnd()
+ m.MoveToEnd()
case key.Matches(msg, m.KeyMap.LowercaseWordForward):
m.lowercaseRight()
case key.Matches(msg, m.KeyMap.UppercaseWordForward):