From d573a74d6cdf039ae146ca079c52134cf579c05d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20B=C3=BCtow?= <1224732+snonux@users.noreply.github.com> Date: Fri, 20 Jun 2025 21:43:04 +0300 Subject: Fix search input hotkey handling --- internal/ui/table.go | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'internal/ui') 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 -- cgit v1.2.3