mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-12 11:15:00 +02:00
28 lines
629 B
Go
28 lines
629 B
Go
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
|
|
}
|