diff options
Diffstat (limited to 'internal/tui/components/chat/editor.go')
| -rw-r--r-- | internal/tui/components/chat/editor.go | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/internal/tui/components/chat/editor.go b/internal/tui/components/chat/editor.go index 0858e22df..3b82c96d3 100644 --- a/internal/tui/components/chat/editor.go +++ b/internal/tui/components/chat/editor.go @@ -13,9 +13,9 @@ import ( "github.com/charmbracelet/bubbles/textarea" tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/lipgloss" - "github.com/sst/opencode/internal/app" "github.com/sst/opencode/internal/message" "github.com/sst/opencode/internal/status" + "github.com/sst/opencode/internal/tui/app" "github.com/sst/opencode/internal/tui/components/dialog" "github.com/sst/opencode/internal/tui/image" "github.com/sst/opencode/internal/tui/layout" @@ -37,10 +37,10 @@ type editorCmp struct { } type EditorKeyMaps struct { - Send key.Binding - OpenEditor key.Binding - Paste key.Binding - HistoryUp key.Binding + Send key.Binding + OpenEditor key.Binding + Paste key.Binding + HistoryUp key.Binding HistoryDown key.Binding } @@ -251,14 +251,14 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) { if m.textarea.Focused() && key.Matches(msg, editorMaps.HistoryUp) && !m.app.IsFilepickerOpen() && !m.app.IsCompletionDialogOpen() { // Get the current line number currentLine := m.textarea.Line() - + // Only navigate history if we're at the first line if currentLine == 0 && len(m.history) > 0 { // Save current message if we're just starting to navigate if m.historyIndex == len(m.history) { m.currentMessage = m.textarea.Value() } - + // Go to previous message in history if m.historyIndex > 0 { m.historyIndex-- @@ -267,14 +267,14 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, nil } } - + if m.textarea.Focused() && key.Matches(msg, editorMaps.HistoryDown) && !m.app.IsFilepickerOpen() && !m.app.IsCompletionDialogOpen() { // Get the current line number and total lines currentLine := m.textarea.Line() value := m.textarea.Value() lines := strings.Split(value, "\n") totalLines := len(lines) - + // Only navigate history if we're at the last line if currentLine == totalLines-1 { if m.historyIndex < len(m.history)-1 { @@ -403,10 +403,10 @@ func CreateTextArea(existing *textarea.Model) textarea.Model { func NewEditorCmp(app *app.App) tea.Model { ta := CreateTextArea(nil) return &editorCmp{ - app: app, - textarea: ta, - history: []string{}, - historyIndex: 0, + app: app, + textarea: ta, + history: []string{}, + historyIndex: 0, currentMessage: "", } } |
