Skip to content

Commit 20e153a

Browse files
andrinofffloatpanebot
authored andcommitted
fix: keybinds working in search mode (#1469)
## What? Ignores plugin keybinds in search mode ## Why? Fixes #1463 Signed-off-by: drew <me@andrinoff.com> (cherry picked from commit fa782ba)
1 parent 8b3d9ed commit 20e153a

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

main.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,8 @@ func (m *mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { //nolint:gocyclo
414414
m.applyPluginFields(composer)
415415
}
416416

417-
// Check plugin key bindings for the current view
418-
if m.plugins != nil {
417+
// Check plugin key bindings for the current view, but not while the search overlay is open
418+
if m.plugins != nil && !m.isSearchOverlayOpen() {
419419
if bindingCmd := m.handlePluginKeyBinding(keyMsg); bindingCmd != nil {
420420
cmds = append(cmds, bindingCmd)
421421
}
@@ -2693,6 +2693,16 @@ func (m *mainModel) handlePluginKeyBinding(msg tea.KeyPressMsg) tea.Cmd {
26932693
return nil
26942694
}
26952695

2696+
func (m *mainModel) isSearchOverlayOpen() bool {
2697+
switch v := m.current.(type) {
2698+
case *tui.Inbox:
2699+
return v.IsSearchOverlayOpen()
2700+
case *tui.FolderInbox:
2701+
return v.GetInbox().IsSearchOverlayOpen()
2702+
}
2703+
return false
2704+
}
2705+
26962706
func (m *mainModel) syncPluginKeyBindings() {
26972707
if m.plugins == nil {
26982708
return

tui/inbox.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,10 @@ func (m *Inbox) IsSearchActive() bool {
12511251
return m != nil && (m.searchOverlay != nil || m.searchActive)
12521252
}
12531253

1254+
func (m *Inbox) IsSearchOverlayOpen() bool {
1255+
return m != nil && m.searchOverlay != nil
1256+
}
1257+
12541258
func (m *Inbox) IsFilterActive() bool {
12551259
return m != nil && (m.list.FilterState() == list.Filtering || m.list.FilterState() == list.FilterApplied)
12561260
}

0 commit comments

Comments
 (0)