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:
@ -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 {
|
||||
|
Reference in New Issue
Block a user