diff options
| author | Grail Finder <wohilas@gmail.com> | 2026-02-27 08:07:55 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2026-02-27 08:07:55 +0300 |
| commit | 0d947340904db30b3dce36f5ebd5230057da9f18 (patch) | |
| tree | ba75552a324fb393ab46556d51770e9bad6897fc /popups.go | |
| parent | a0ff384b815f525bf15e6928e9a00b7019156e41 (diff) | |
Enha: tool role index for shellmode
Diffstat (limited to 'popups.go')
| -rw-r--r-- | popups.go | 62 |
1 files changed, 0 insertions, 62 deletions
@@ -343,68 +343,6 @@ func showBotRoleSelectionPopup() { app.SetFocus(roleListWidget) } -func showFileCompletionPopup(filter string) { - baseDir := cfg.FilePickerDir - if baseDir == "" { - baseDir = "." - } - complMatches := scanFiles(baseDir, filter) - 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) - for _, m := range complMatches { - widget.AddItem(m, "", 0, nil) - } - widget.SetSelectedFunc(func(index int, mainText string, secondaryText string, shortcut rune) { - currentText := textArea.GetText() - atIdx := strings.LastIndex(currentText, "@") - if atIdx >= 0 { - before := currentText[:atIdx] - textArea.SetText(before+mainText, true) - } - pages.RemovePage("fileCompletionPopup") - app.SetFocus(textArea) - }) - widget.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { - if event.Key() == tcell.KeyEscape { - pages.RemovePage("fileCompletionPopup") - app.SetFocus(textArea) - return nil - } - if event.Key() == tcell.KeyRune && event.Rune() == 'x' { - pages.RemovePage("fileCompletionPopup") - app.SetFocus(textArea) - return nil - } - return event - }) - modal := func(p tview.Primitive, width, height int) tview.Primitive { - return tview.NewFlex(). - AddItem(nil, 0, 1, false). - AddItem(tview.NewFlex().SetDirection(tview.FlexRow). - AddItem(nil, 0, 1, false). - AddItem(p, height, 1, true). - AddItem(nil, 0, 1, false), width, 1, true). - AddItem(nil, 0, 1, false) - } - // Add modal page and make it visible - pages.AddPage("fileCompletionPopup", modal(widget, 80, 20), true, true) - app.SetFocus(widget) -} - func showShellFileCompletionPopup(filter string) { baseDir := cfg.FilePickerDir if baseDir == "" { |
