diff options
Diffstat (limited to 'pkg/gui/gui.go')
-rw-r--r-- | pkg/gui/gui.go | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index bc6448374..12d680ab9 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -411,8 +411,6 @@ func (gui *Gui) Run() error { g.NextSearchMatchKey = gui.getKey("universal.nextMatch") g.PrevSearchMatchKey = gui.getKey("universal.prevMatch") - gui.stopChan = make(chan struct{}) - g.ASCII = runtime.GOOS == "windows" && runewidth.IsEastAsian() if gui.Config.GetUserConfig().GetBool("gui.mouseEvents") { @@ -453,6 +451,7 @@ func (gui *Gui) Run() error { // otherwise it handles the error, possibly by quitting the application func (gui *Gui) RunWithSubprocesses() error { for { + gui.stopChan = make(chan struct{}) if err := gui.Run(); err != nil { for _, manager := range gui.viewBufferManagerMap { manager.Close() @@ -465,28 +464,27 @@ func (gui *Gui) RunWithSubprocesses() error { close(gui.stopChan) - if err == gocui.ErrQuit { + switch err { + case gocui.ErrQuit: if !gui.State.RetainOriginalDir { if err := gui.recordCurrentDirectory(); err != nil { return err } } - break - } else if err == gui.Errors.ErrSwitchRepo { - continue - } else if err == gui.Errors.ErrRestart { + return nil + case gui.Errors.ErrSwitchRepo, gui.Errors.ErrRestart: continue - } else if err == gui.Errors.ErrSubProcess { + case gui.Errors.ErrSubProcess: + if err := gui.runCommand(); err != nil { return err } - } else { + default: return err } } } - return nil } func (gui *Gui) runCommand() error { |