2020-03-29 01:31:34 +02:00
|
|
|
package gui
|
|
|
|
|
|
|
|
func (gui *Gui) inFilterMode() bool {
|
|
|
|
return gui.State.FilterPath != ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func (gui *Gui) validateNotInFilterMode() (bool, error) {
|
|
|
|
if gui.inFilterMode() {
|
2020-08-15 08:38:16 +02:00
|
|
|
err := gui.ask(askOpts{
|
2020-08-15 08:36:39 +02:00
|
|
|
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
|
2020-03-29 01:31:34 +02:00
|
|
|
}
|
|
|
|
return true, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (gui *Gui) exitFilterMode() error {
|
|
|
|
gui.State.FilterPath = ""
|
|
|
|
return gui.Errors.ErrRestart
|
|
|
|
}
|