summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Bütow <1224732+snonux@users.noreply.github.com>2025-06-20 21:43:04 +0300
committerPaul Bütow <1224732+snonux@users.noreply.github.com>2025-06-20 21:43:04 +0300
commitd573a74d6cdf039ae146ca079c52134cf579c05d (patch)
tree648aa0dd54ce4e34a16f0cb8eab9f51fda25a566 /internal
parent46b0e18d9a5bf574b6d4b667d6dffe25eeace426 (diff)
Fix search input hotkey handling
Diffstat (limited to 'internal')
-rw-r--r--internal/ui/table.go50
1 files changed, 25 insertions, 25 deletions
diff --git a/internal/ui/table.go b/internal/ui/table.go
index b5e5d74..c0b9f90 100644
--- a/internal/ui/table.go
+++ b/internal/ui/table.go
@@ -216,31 +216,6 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.prioritySelecting = false
return m, nil
}
- if m.searching {
- switch msg.Type {
- case tea.KeyEnter:
- re, err := regexp.Compile(m.searchInput.Value())
- if err == nil {
- m.searchRegex = re
- } else {
- m.searchRegex = nil
- }
- m.searching = false
- m.searchInput.Blur()
- m.reload()
- if len(m.searchRows) > 0 {
- m.tbl.SetCursor(m.searchRows[m.searchIndex])
- }
- return m, nil
- case tea.KeyEsc:
- m.searching = false
- m.searchInput.Blur()
- return m, nil
- }
- var cmd tea.Cmd
- m.searchInput, cmd = m.searchInput.Update(msg)
- return m, cmd
- }
switch msg.String() {
case "h", "left":
m.priorityIndex = (m.priorityIndex + len(priorityOptions) - 1) % len(priorityOptions)
@@ -249,6 +224,31 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
return m, nil
}
+ if m.searching {
+ switch msg.Type {
+ case tea.KeyEnter:
+ re, err := regexp.Compile(m.searchInput.Value())
+ if err == nil {
+ m.searchRegex = re
+ } else {
+ m.searchRegex = nil
+ }
+ m.searching = false
+ m.searchInput.Blur()
+ m.reload()
+ if len(m.searchRows) > 0 {
+ m.tbl.SetCursor(m.searchRows[m.searchIndex])
+ }
+ return m, nil
+ case tea.KeyEsc:
+ m.searching = false
+ m.searchInput.Blur()
+ return m, nil
+ }
+ var cmd tea.Cmd
+ m.searchInput, cmd = m.searchInput.Update(msg)
+ return m, cmd
+ }
switch msg.String() {
case "?":
m.showHelp = true