fix: keybinds working in search mode (#1469)

Drew Smirnoff created

## What?

Ignores plugin keybinds in search mode

## Why?

Fixes #1463

Signed-off-by: drew <me@andrinoff.com>

Change summary

main.go      | 14 ++++++++++++--
tui/inbox.go |  4 ++++
2 files changed, 16 insertions(+), 2 deletions(-)

Detailed changes

main.go 🔗

@@ -332,8 +332,8 @@ func (m *mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { //nolint:gocyclo
 			m.applyPluginFields(composer)
 		}
 
-		// Check plugin key bindings for the current view
-		if m.plugins != nil {
+		// Check plugin key bindings for the current view, but not while the search overlay is open
+		if m.plugins != nil && !m.isSearchOverlayOpen() {
 			if bindingCmd := m.handlePluginKeyBinding(keyMsg); bindingCmd != nil {
 				cmds = append(cmds, bindingCmd)
 			}
@@ -2458,6 +2458,16 @@ func (m *mainModel) handlePluginKeyBinding(msg tea.KeyPressMsg) tea.Cmd {
 	return nil
 }
 
+func (m *mainModel) isSearchOverlayOpen() bool {
+	switch v := m.current.(type) {
+	case *tui.Inbox:
+		return v.IsSearchOverlayOpen()
+	case *tui.FolderInbox:
+		return v.GetInbox().IsSearchOverlayOpen()
+	}
+	return false
+}
+
 func (m *mainModel) syncPluginKeyBindings() {
 	if m.plugins == nil {
 		return

tui/inbox.go 🔗

@@ -1247,6 +1247,10 @@ func (m *Inbox) IsSearchActive() bool {
 	return m != nil && (m.searchOverlay != nil || m.searchActive)
 }
 
+func (m *Inbox) IsSearchOverlayOpen() bool {
+	return m != nil && m.searchOverlay != nil
+}
+
 func (m *Inbox) IsFilterActive() bool {
 	return m != nil && (m.list.FilterState() == list.Filtering || m.list.FilterState() == list.FilterApplied)
 }