diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-18 09:03:52 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-23 14:29:18 +1000 |
commit | 3c87ff4eff46449d5e697e954b3bdf01d2c76f19 (patch) | |
tree | c1c8c67ba187d1d145e803a99957093682e3145b /pkg/gui/diffing.go | |
parent | 0f7b2c45d773989229cb84a0147232962c6ae0e0 (diff) |
WIP: standardising how we render to main
Diffstat (limited to 'pkg/gui/diffing.go')
-rw-r--r-- | pkg/gui/diffing.go | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/pkg/gui/diffing.go b/pkg/gui/diffing.go index 7418cf3aa..4e88f2e8b 100644 --- a/pkg/gui/diffing.go +++ b/pkg/gui/diffing.go @@ -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. |