summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-11-29 14:06:05 +0300
committerGrail Finder <wohilas@gmail.com>2025-11-29 14:06:05 +0300
commitc1b689a4b5cced7558563412189c0a00108cc249 (patch)
tree231916a0d04cf8321d11da2c6a7ed548312ebcdf
parent869e743248f82101663631469a9a6b355c4b3095 (diff)
Enha: empty string search to cancel
-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")