1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

WIP: standardising how we render to main

This commit is contained in:
Jesse Duffield
2020-08-18 09:03:52 +10:00
parent 0f7b2c45d7
commit 3c87ff4eff
5 changed files with 125 additions and 60 deletions

View File

@ -18,20 +18,22 @@ func (gui *Gui) exitDiffMode() error {
}
func (gui *Gui) renderDiff() error {
gui.getMainView().Title = "Diff"
gui.splitMainPanel(false)
filterArg := ""
if gui.inFilterMode() {
filterArg = fmt.Sprintf(" -- %s", gui.State.FilterPath)
}
return gui.refreshMain(refreshMainOpts{
main: &viewUpdateOpts{
title: "Diff",
task: func() error {
filterArg := ""
if gui.inFilterMode() {
filterArg = fmt.Sprintf(" -- %s", gui.State.FilterPath)
}
cmd := gui.OSCommand.ExecutableFromString(
fmt.Sprintf("git diff --color %s %s", gui.diffStr(), filterArg),
)
if err := gui.newPtyTask("main", cmd); err != nil {
gui.Log.Error(err)
}
return nil
cmd := gui.OSCommand.ExecutableFromString(
fmt.Sprintf("git diff --color %s %s", gui.diffStr(), filterArg),
)
return gui.newPtyTask("main", cmd)
},
},
})
}
// currentDiffTerminals returns the current diff terminals of the currently selected item.