diff options
| author | Paul Bütow <1224732+snonux@users.noreply.github.com> | 2025-06-20 21:43:45 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-20 21:43:45 +0300 |
| commit | bde50a027a623b5720f709d67fe9b3cae51bdfa2 (patch) | |
| tree | cc6aaacaae5312232467e267583a780d0ef5d262 /internal | |
| parent | d4bf9ac060c6d64f00a06e7a54f01c61091131b5 (diff) | |
| parent | d573a74d6cdf039ae146ca079c52134cf579c05d (diff) | |
Merge pull request #53 from snonux/codex/add-hotkey-to-search-with-regex
Fix search input hotkey handling
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/ui/table.go | 50 |
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 |
