diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-15 16:36:39 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-15 18:01:43 +1000 |
commit | d9fa02c53bb9b401f1b5ca07e8ed239862052a42 (patch) | |
tree | 9ce89793ba22ffc190ab6133365035dda4ec1ade /pkg/gui/filtering.go | |
parent | c44ee71ad4ca44a407613c1e91f7d720acfa84f6 (diff) |
clean up interface for popup panels
Diffstat (limited to 'pkg/gui/filtering.go')
-rw-r--r-- | pkg/gui/filtering.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/pkg/gui/filtering.go b/pkg/gui/filtering.go index 66232e3fb..3acb3c34a 100644 --- a/pkg/gui/filtering.go +++ b/pkg/gui/filtering.go @@ -1,16 +1,22 @@ package gui -import "github.com/jesseduffield/gocui" - func (gui *Gui) inFilterMode() bool { return gui.State.FilterPath != "" } func (gui *Gui) validateNotInFilterMode() (bool, error) { if gui.inFilterMode() { - return false, gui.createConfirmationPanel(gui.g, gui.g.CurrentView(), true, gui.Tr.SLocalize("MustExitFilterModeTitle"), gui.Tr.SLocalize("MustExitFilterModePrompt"), func(*gocui.Gui, *gocui.View) error { - return gui.exitFilterMode() - }, nil) + err := gui.createConfirmationPanel(createConfirmationPanelOpts{ + returnToView: gui.g.CurrentView(), + returnFocusOnClose: true, + title: gui.Tr.SLocalize("MustExitFilterModeTitle"), + prompt: gui.Tr.SLocalize("MustExitFilterModePrompt"), + handleConfirm: func() error { + return gui.exitFilterMode() + }, + }) + + return false, err } return true, nil } |