diff --git a/ui/pages/selection/selection.go b/ui/pages/selection/selection.go index 6ac4bf786..52cd06cc5 100644 --- a/ui/pages/selection/selection.go +++ b/ui/pages/selection/selection.go @@ -5,6 +5,7 @@ import ( "strings" "github.com/charmbracelet/bubbles/key" + "github.com/charmbracelet/bubbles/list" tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/lipgloss" "github.com/charmbracelet/soft-serve/config" @@ -88,6 +89,11 @@ func (s *Selection) getMargins() (wm, hm int) { return } +// FilterState returns the current filter state. +func (s *Selection) FilterState() list.FilterState { + return s.selector.FilterState() +} + // SetSize implements common.Component. func (s *Selection) SetSize(width, height int) { s.common.SetSize(width, height) diff --git a/ui/ui.go b/ui/ui.go index 1eb1e0d43..3f18e577e 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -2,6 +2,7 @@ package ui import ( "github.com/charmbracelet/bubbles/key" + "github.com/charmbracelet/bubbles/list" tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/lipgloss" "github.com/charmbracelet/soft-serve/config" @@ -180,9 +181,17 @@ func (ui *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case key.Matches(msg, ui.common.KeyMap.Help): cmds = append(cmds, footer.ToggleFooterCmd) case key.Matches(msg, ui.common.KeyMap.Quit): - // Stop bubblezone background workers. - ui.common.Zone.Close() - return ui, tea.Quit + switch { + case ui.activePage == selectionPage: + if s, ok := ui.pages[selectionPage].(*selection.Selection); ok && s.FilterState() == list.Filtering { + break + } + fallthrough + default: + // Stop bubblezone background workers. + ui.common.Zone.Close() + return ui, tea.Quit + } case ui.activePage == repoPage && key.Matches(msg, ui.common.KeyMap.Back): ui.activePage = selectionPage // Always show the footer on selection page.