From b18d96ac13539bd18e891bb8b6c934910d36800f Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Thu, 19 Feb 2026 08:35:21 +0300 Subject: Enha: remade within a popup --- tui.go | 51 +-------------------------------------------------- 1 file changed, 1 insertion(+), 50 deletions(-) (limited to 'tui.go') diff --git a/tui.go b/tui.go index 275aab7..a681358 100644 --- a/tui.go +++ b/tui.go @@ -49,14 +49,6 @@ var ( imgPage = "imgPage" filePickerPage = "filePicker" exportDir = "chat_exports" - - // file completion - complPopup *tview.List - complActive bool - complAtPos int - complMatches []string - complIndex int - // For overlay search functionality searchField *tview.InputField searchPageName = "searchOverlay" @@ -185,53 +177,12 @@ func init() { textArea = tview.NewTextArea(). SetPlaceholder("input is multiline; press to start the next line;\npress to send the message.") textArea.SetBorder(true).SetTitle("input") - - // Setup file completion popup - complPopup = tview.NewList() - complPopup.SetBorder(true).SetTitle("Files (@ to trigger)") - pages.AddPage("complPopup", complPopup, false, false) - // Add input capture for @ completion textArea.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { if shellMode && event.Key() == tcell.KeyRune && event.Rune() == '@' { - complAtPos = len(textArea.GetText()) - showFileCompletion("") + showFileCompletionPopup("") return event } - if complActive { - switch event.Key() { - case tcell.KeyUp: - if complIndex > 0 { - complIndex-- - complPopup.SetCurrentItem(complIndex) - } - return nil - case tcell.KeyDown: - if complIndex < len(complMatches)-1 { - complIndex++ - complPopup.SetCurrentItem(complIndex) - } - return nil - case tcell.KeyTab, tcell.KeyEnter: - if len(complMatches) > 0 { - insertCompletion() - } - return nil - case tcell.KeyEsc: - hideCompletion() - return nil - } - } - if complActive && event.Key() == tcell.KeyRune { - r := event.Rune() - if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9') || r == '-' || r == '_' || r == '/' || r == '.' { - currentText := textArea.GetText() - if len(currentText) > complAtPos { - filter := currentText[complAtPos+1:] - showFileCompletion(filter) - } - } - } return event }) textView = tview.NewTextView(). -- cgit v1.2.3