From 0d947340904db30b3dce36f5ebd5230057da9f18 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Fri, 27 Feb 2026 08:07:55 +0300 Subject: Enha: tool role index for shellmode --- popups.go | 62 -------------------------------------------------------------- 1 file changed, 62 deletions(-) (limited to 'popups.go') diff --git a/popups.go b/popups.go index 84b13c4..22873d2 100644 --- a/popups.go +++ b/popups.go @@ -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 == "" { -- cgit v1.2.3