The open source coding agent.
TypeScript
really disable history nav when completions dialog is open (#50)
Ed Zyndab9ebcea82c26
diff --git a/internal/app/app.go b/internal/app/app.goindex 943f1b24e4a..41070684ecb 100644--- a/internal/app/app.go+++ b/internal/app/app.go@@ -43,6 +43,7 @@ type App struct {// UI statefilepickerOpen bool+ completionDialogOpen bool}func New(ctx context.Context, conn *sql.DB) (*App, error) {@@ -141,6 +142,16 @@ func (app *App) SetFilepickerOpen(open bool) {app.filepickerOpen = open}+// IsCompletionDialogOpen returns whether the completion dialog is currently open+func (app *App) IsCompletionDialogOpen() bool {+ return app.completionDialogOpen+}++// SetCompletionDialogOpen sets the state of the completion dialog+func (app *App) SetCompletionDialogOpen(open bool) {+ app.completionDialogOpen = open+}+// Shutdown performs a clean shutdown of the applicationfunc (app *App) Shutdown() {// Cancel all watcher goroutinesdiff --git a/internal/tui/components/chat/editor.go b/internal/tui/components/chat/editor.goindex 212ad5529c1..0858e22dfa5 100644--- a/internal/tui/components/chat/editor.go+++ b/internal/tui/components/chat/editor.go@@ -247,8 +247,8 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {}// Handle history navigation with up/down arrow keys- // Only handle history navigation if the filepicker is not open- if m.textarea.Focused() && key.Matches(msg, editorMaps.HistoryUp) && !m.app.IsFilepickerOpen() {+ // Only handle history navigation if the filepicker is not open and completion dialog is not open+ if m.textarea.Focused() && key.Matches(msg, editorMaps.HistoryUp) && !m.app.IsFilepickerOpen() && !m.app.IsCompletionDialogOpen() {// Get the current line numbercurrentLine := m.textarea.Line()@@ -268,7 +268,7 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {}}- if m.textarea.Focused() && key.Matches(msg, editorMaps.HistoryDown) && !m.app.IsFilepickerOpen() {+ if m.textarea.Focused() && key.Matches(msg, editorMaps.HistoryDown) && !m.app.IsFilepickerOpen() && !m.app.IsCompletionDialogOpen() {// Get the current line number and total linescurrentLine := m.textarea.Line()value := m.textarea.Value()diff --git a/internal/tui/page/chat.go b/internal/tui/page/chat.goindex 1b31c838c3b..e4fb62cafc4 100644--- a/internal/tui/page/chat.go+++ b/internal/tui/page/chat.go@@ -123,10 +123,12 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {return p, nilcase dialog.CompletionDialogCloseMsg:p.showCompletionDialog = false+ p.app.SetCompletionDialogOpen(false)case tea.KeyMsg:switch {case key.Matches(msg, keyMap.ShowCompletionDialog):p.showCompletionDialog = true+ p.app.SetCompletionDialogOpen(true)// Continue sending keys to layout->chatcase key.Matches(msg, keyMap.NewSession):p.app.CurrentSession = &session.Session{}