1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-09 13:47:11 +02:00
This commit is contained in:
Jesse Duffield 2021-04-03 22:47:22 +11:00
parent 4b69ab08c1
commit 4197921465
4 changed files with 8 additions and 16 deletions

View File

@ -306,28 +306,23 @@ func runLazygit(t *testing.T, testPath string, rootDir string, record bool, spee
err = oscommands.CopyDir(templateConfigDir, configDir)
assert.NoError(t, err)
cmdStr := fmt.Sprintf("sudo dtruss %s --use-config-dir=%s --path=%s", tempLazygitPath(), configDir, actualDir)
cmdStr := fmt.Sprintf("%s --use-config-dir=%s --path=%s", tempLazygitPath(), configDir, actualDir)
cmd := osCommand.ExecutableFromString(cmdStr)
cmd.Env = append(cmd.Env, fmt.Sprintf("REPLAY_SPEED=%d", speed))
if record {
cmd.Stdout = os.Stdout
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Env = append(
os.Environ(),
cmd.Env,
fmt.Sprintf("RECORD_EVENTS_TO=%s", replayPath),
"TERM=xterm-256color",
)
} else {
cmd.Stdout = os.Stdout
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Env = append(
os.Environ(),
cmd.Env,
fmt.Sprintf("REPLAY_EVENTS_FROM=%s", replayPath),
"TERM=xterm-256color",
)
t.Log(spew.Sdump(cmd))
}
@ -360,7 +355,7 @@ func runInParallel() bool {
}
func runInPTY() bool {
return runInParallel() || os.Getenv("TERM") == ""
return true
}
func prepareIntegrationTestDir(actualDir string) {

View File

@ -109,12 +109,9 @@ func (gui *Gui) loadRecordedEvents() ([]RecordedEvent, error) {
err = json.Unmarshal(data, &events)
if err != nil {
panic(err)
return nil, err
}
panic(events)
return events, nil
}
@ -123,11 +120,8 @@ func (gui *Gui) saveRecordedEvents() error {
return nil
}
gui.Log.Warn(gui.RecordedEvents)
jsonEvents, err := json.Marshal(gui.RecordedEvents)
if err != nil {
panic(err)
return err
}

View File

@ -597,6 +597,10 @@ func (g *Gui) consumeevents() error {
// handleEvent handles an event, based on its type (key-press, error,
// etc.)
func (g *Gui) handleEvent(ev *GocuiEvent) error {
if g.RecordEvents {
g.RecordedEvents <- ev
}
switch ev.Type {
case eventKey, eventMouse:
return g.onKey(ev)

View File

@ -117,7 +117,6 @@ type GocuiEvent struct {
MouseX int
MouseY int
N int
Bytes string
}
// Event types.