summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoradamdotdevin <[email protected]>2025-07-14 12:20:58 -0500
committeradamdotdevin <[email protected]>2025-07-14 12:20:58 -0500
commitba676e7ae095a6e2089b2b061a1ec8f3cffd4e42 (patch)
tree35424a20bc8752c557b63dc8d5a39b6a45f35096
parenta1c8e5af454fb5db562334fa66efe3f4d5d014f1 (diff)
downloadopencode-ba676e7ae095a6e2089b2b061a1ec8f3cffd4e42.tar.gz
opencode-ba676e7ae095a6e2089b2b061a1ec8f3cffd4e42.zip
fix(tui): support readline nav in new search component
-rw-r--r--packages/tui/internal/components/dialog/search.go4
-rw-r--r--packages/tui/internal/tui/tui.go7
2 files changed, 3 insertions, 8 deletions
diff --git a/packages/tui/internal/components/dialog/search.go b/packages/tui/internal/components/dialog/search.go
index 53f3c67b7..2eae4cded 100644
--- a/packages/tui/internal/components/dialog/search.go
+++ b/packages/tui/internal/components/dialog/search.go
@@ -42,11 +42,11 @@ type searchKeyMap struct {
var searchKeys = searchKeyMap{
Up: key.NewBinding(
- key.WithKeys("up"),
+ key.WithKeys("up", "ctrl+p"),
key.WithHelp("↑", "previous item"),
),
Down: key.NewBinding(
- key.WithKeys("down"),
+ key.WithKeys("down", "ctrl+n"),
key.WithHelp("↓", "next item"),
),
Enter: key.NewBinding(
diff --git a/packages/tui/internal/tui/tui.go b/packages/tui/internal/tui/tui.go
index 0ebdd35ab..a2291bcf7 100644
--- a/packages/tui/internal/tui/tui.go
+++ b/packages/tui/internal/tui/tui.go
@@ -69,7 +69,6 @@ type appModel struct {
fileProvider dialog.CompletionProvider
symbolsProvider dialog.CompletionProvider
showCompletionDialog bool
- fileCompletionActive bool
leaderBinding *key.Binding
// isLeaderSequence bool
toastManager *toast.ToastManager
@@ -155,7 +154,6 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
!a.showCompletionDialog &&
a.editor.Value() == "" {
a.showCompletionDialog = true
- a.fileCompletionActive = false
updated, cmd := a.editor.Update(msg)
a.editor = updated.(chat.EditorComponent)
@@ -174,7 +172,6 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if keyString == "@" &&
!a.showCompletionDialog {
a.showCompletionDialog = true
- a.fileCompletionActive = true
updated, cmd := a.editor.Update(msg)
a.editor = updated.(chat.EditorComponent)
@@ -191,7 +188,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if a.showCompletionDialog {
switch keyString {
- case "tab", "enter", "esc", "ctrl+c", "up", "down":
+ case "tab", "enter", "esc", "ctrl+c", "up", "down", "ctrl+p", "ctrl+n":
updated, cmd := a.completions.Update(msg)
a.completions = updated.(dialog.CompletionDialog)
cmds = append(cmds, cmd)
@@ -356,7 +353,6 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
cmds = append(cmds, cmd)
case dialog.CompletionDialogCloseMsg:
a.showCompletionDialog = false
- a.fileCompletionActive = false
case opencode.EventListResponseEventInstallationUpdated:
return a, toast.NewSuccessToast(
"opencode updated to "+msg.Properties.Version+", restart to apply.",
@@ -1043,7 +1039,6 @@ func NewModel(app *app.App) tea.Model {
symbolsProvider: symbolsProvider,
leaderBinding: leaderBinding,
showCompletionDialog: false,
- fileCompletionActive: false,
toastManager: toast.NewToastManager(),
interruptKeyState: InterruptKeyIdle,
exitKeyState: ExitKeyIdle,