blob: efca602f30554bdc5bf9987056025b7fa0cf2109 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package gui
func (gui *Gui) inFilterMode() bool {
return gui.State.FilterPath != ""
}
func (gui *Gui) validateNotInFilterMode() (bool, error) {
if gui.inFilterMode() {
err := gui.ask(askOpts{
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
}
func (gui *Gui) exitFilterMode() error {
gui.State.FilterPath = ""
return gui.Errors.ErrRestart
}
|