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/reflog_panel.go | |
parent | 0f7b2c45d773989229cb84a0147232962c6ae0e0 (diff) |
WIP: standardising how we render to main
Diffstat (limited to 'pkg/gui/reflog_panel.go')
-rw-r--r-- | pkg/gui/reflog_panel.go | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/pkg/gui/reflog_panel.go b/pkg/gui/reflog_panel.go index 038e2bf7e..c1cc118de 100644 --- a/pkg/gui/reflog_panel.go +++ b/pkg/gui/reflog_panel.go @@ -19,30 +19,28 @@ func (gui *Gui) getSelectedReflogCommit() *commands.Commit { } func (gui *Gui) handleReflogCommitSelect() error { - if gui.popupPanelFocused() { - return nil + if gui.inDiffMode() { + return gui.renderDiff() } - gui.splitMainPanel(false) - - gui.getMainView().Title = "Reflog Entry" + refreshOpts := refreshMainOpts{ + main: &viewUpdateOpts{ + title: "Reflog Entry", + }, + } commit := gui.getSelectedReflogCommit() if commit == nil { - return gui.newStringTask("main", "No reflog history") - } - if gui.inDiffMode() { - return gui.renderDiff() - } + refreshOpts.main.task = func() error { return gui.newStringTask("main", "No reflog history") } + } else { + cmd := gui.OSCommand.ExecutableFromString( + gui.GitCommand.ShowCmdStr(commit.Sha, gui.State.FilterPath), + ) - cmd := gui.OSCommand.ExecutableFromString( - gui.GitCommand.ShowCmdStr(commit.Sha, gui.State.FilterPath), - ) - if err := gui.newPtyTask("main", cmd); err != nil { - gui.Log.Error(err) + refreshOpts.main.task = func() error { return gui.newPtyTask("main", cmd) } } - return nil + return gui.refreshMain(refreshOpts) } // the reflogs panel is the only panel where we cache data, in that we only |