diff options
| author | Grail Finder <wohilas@gmail.com> | 2026-02-19 08:53:09 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2026-02-19 08:53:09 +0300 |
| commit | eeca909b6573e14b51f9fe5ce5451c90ab95a00e (patch) | |
| tree | a4794c6d6b1c0042f9dea55aae661d7306889b1a /popups.go | |
| parent | b18d96ac13539bd18e891bb8b6c934910d36800f (diff) | |
Feat: working tab completion in shell mode
Diffstat (limited to 'popups.go')
| -rw-r--r-- | popups.go | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -70,6 +70,10 @@ func showModelSelectionPopup() { pages.RemovePage("modelSelectionPopup") return nil } + if event.Key() == tcell.KeyRune && event.Rune() == 'x' { + pages.RemovePage("modelSelectionPopup") + return nil + } return event }) modal := func(p tview.Primitive, width, height int) tview.Primitive { @@ -163,6 +167,10 @@ func showAPILinkSelectionPopup() { pages.RemovePage("apiLinkSelectionPopup") return nil } + if event.Key() == tcell.KeyRune && event.Rune() == 'x' { + pages.RemovePage("apiLinkSelectionPopup") + return nil + } return event }) modal := func(p tview.Primitive, width, height int) tview.Primitive { @@ -229,6 +237,10 @@ func showUserRoleSelectionPopup() { pages.RemovePage("userRoleSelectionPopup") return nil } + if event.Key() == tcell.KeyRune && event.Rune() == 'x' { + pages.RemovePage("userRoleSelectionPopup") + return nil + } return event }) modal := func(p tview.Primitive, width, height int) tview.Primitive { @@ -297,6 +309,10 @@ func showBotRoleSelectionPopup() { pages.RemovePage("botRoleSelectionPopup") return nil } + if event.Key() == tcell.KeyRune && event.Rune() == 'x' { + pages.RemovePage("botRoleSelectionPopup") + return nil + } return event }) modal := func(p tview.Primitive, width, height int) tview.Primitive { @@ -322,6 +338,16 @@ func showFileCompletionPopup(filter string) { if len(complMatches) == 0 { return } + // If only one match, auto-complete without showing popup + if len(complMatches) == 1 { + currentText := textArea.GetText() + atIdx := strings.LastIndex(currentText, "@") + if atIdx >= 0 { + before := currentText[:atIdx] + textArea.SetText(before+complMatches[0], true) + } + return + } widget := tview.NewList().ShowSecondaryText(false). SetSelectedBackgroundColor(tcell.ColorGray) widget.SetTitle("file completion").SetBorder(true) @@ -337,6 +363,17 @@ func showFileCompletionPopup(filter string) { } pages.RemovePage("fileCompletionPopup") }) + widget.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { + if event.Key() == tcell.KeyEscape { + pages.RemovePage("fileCompletionPopup") + return nil + } + if event.Key() == tcell.KeyRune && event.Rune() == 'x' { + pages.RemovePage("fileCompletionPopup") + return nil + } + return event + }) modal := func(p tview.Primitive, width, height int) tview.Primitive { return tview.NewFlex(). AddItem(nil, 0, 1, false). |
