1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

Mid refactor change some more stuff

This commit is contained in:
Andrei Miulescu
2018-08-12 21:04:47 +10:00
parent e65ddd7b6f
commit e8eb78617c
16 changed files with 220 additions and 118 deletions

View File

@ -5,6 +5,9 @@ import (
// "io"
// "io/ioutil"
"errors"
"log"
"os/exec"
"runtime"
"strings"
"time"
@ -19,6 +22,13 @@ import (
// OverlappingEdges determines if panel edges overlap
var OverlappingEdges = false
// ErrSubprocess tells us we're switching to a subprocess so we need to
// close the Gui until it is finished
var (
ErrSubprocess = errors.New("running subprocess")
subprocess *exec.Cmd
)
type stateType struct {
GitFiles []git.File
Branches []git.Branch
@ -273,6 +283,20 @@ func resizePopupPanels(g *gocui.Gui) error {
return nil
}
func RunWithSubprocesses() {
for {
if err := run(); err != nil {
if err == gocui.ErrQuit {
break
} else if err == ErrSubprocess {
subprocess.Run()
} else {
log.Panicln(err)
}
}
}
}
func run() (err error) {
g, err := gocui.NewGui(gocui.OutputNormal, OverlappingEdges)
if err != nil {