summaryrefslogtreecommitdiff
path: root/tui.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2026-02-19 08:35:21 +0300
committerGrail Finder <wohilas@gmail.com>2026-02-19 08:35:21 +0300
commitb18d96ac13539bd18e891bb8b6c934910d36800f (patch)
treece2ceba55185c00d88d87dd0c3fe3f54fdcb1be7 /tui.go
parentb861b92e5d63dcfc3b06030006668fac1247e5a8 (diff)
Enha: remade within a popup
Diffstat (limited to 'tui.go')
-rw-r--r--tui.go51
1 files changed, 1 insertions, 50 deletions
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 <Enter> to start the next line;\npress <Esc> 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().