summaryrefslogtreecommitdiffstats
path: root/pkg/gui
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-08-23 20:20:05 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-08-24 09:19:56 +1000
commit44ee28bb2ee69684cac7982626bea12074a8af31 (patch)
treef169d243f1f663642080b05b976547773a85953b /pkg/gui
parentf172f20219096e6dac26f8f01e7a7fe1f3b5d3ef (diff)
support alacritty
Diffstat (limited to 'pkg/gui')
-rw-r--r--pkg/gui/gui.go18
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 {