summaryrefslogtreecommitdiff
path: root/tui.go
diff options
context:
space:
mode:
Diffstat (limited to 'tui.go')
-rw-r--r--tui.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/tui.go b/tui.go
index c6eb453..733313b 100644
--- a/tui.go
+++ b/tui.go
@@ -860,18 +860,24 @@ func init() {
})
//
searchField = tview.NewInputField().
- SetPlaceholder("Search... (Enter: search, Esc: cancel)").
+ SetPlaceholder("Search... (Enter: search)").
SetDoneFunc(func(key tcell.Key) {
if key == tcell.KeyEnter {
term := searchField.GetText()
- if term != "" {
+ if term == "" {
+ // If the search term is empty, cancel the search
+ hideSearchBar()
+ searchResults = nil
+ searchResultLengths = nil
+ textView.SetText(chatToText(cfg.ShowSys))
+ colorText()
+ return
+ } else {
performSearch(term)
// Keep focus on textView after search
app.SetFocus(textView)
+ hideSearchBar()
}
- hideSearchBar()
- } else if key == tcell.KeyEscape {
- hideSearchBar()
}
})
searchField.SetBorder(true).SetTitle("Search")