diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-16 13:58:29 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-23 14:29:18 +1000 |
commit | 7f89113245307be8a1642105014e9ce51a47210f (patch) | |
tree | 0b1237c4bdd4a465bedb7cc49c8372d0bfc46ea5 /pkg/gui/files_panel.go | |
parent | 0ea0c486310558e26af7ad6e4fcf17f57c2b62e3 (diff) |
WIP
Diffstat (limited to 'pkg/gui/files_panel.go')
-rw-r--r-- | pkg/gui/files_panel.go | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index 37918067d..a2e51d7c8 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -171,11 +171,10 @@ func (gui *Gui) enterFile(forceSecondaryFocused bool, selectedLineIdx int) error if file.HasMergeConflicts { return gui.createErrorPanel(gui.Tr.SLocalize("FileStagingRequirements")) } - gui.changeMainViewsContext("staging") - if err := gui.switchFocus(gui.getFilesView(), gui.getMainView()); err != nil { - return err - } - return gui.refreshStagingPanel(forceSecondaryFocused, selectedLineIdx) + gui.changeMainViewsContext("staging") // TODO: move into context code + gui.switchContext(gui.Contexts.Staging.Context) + + return gui.refreshStagingPanel(forceSecondaryFocused, selectedLineIdx) // TODO: check if this is broken, try moving into context code } func (gui *Gui) handleFilePress() error { @@ -310,11 +309,7 @@ func (gui *Gui) handleCommitPress() error { } gui.g.Update(func(g *gocui.Gui) error { - if _, err := g.SetViewOnTop("commitMessage"); err != nil { - return err - } - - if err := gui.switchFocus(gui.getFilesView(), commitMessageView); err != nil { + if err := gui.switchContext(gui.Contexts.CommitMessage.Context); err != nil { return err } @@ -596,11 +591,8 @@ func (gui *Gui) handleSwitchToMerge() error { if !file.HasInlineMergeConflicts { return gui.createErrorPanel(gui.Tr.SLocalize("FileNoMergeCons")) } - gui.changeMainViewsContext("merging") - if err := gui.switchFocus(gui.g.CurrentView(), gui.getMainView()); err != nil { - return err - } - return gui.refreshMergePanel() + gui.changeMainViewsContext("merging") // TODO: move into context code + return gui.switchContext(gui.Contexts.Merging.Context) } func (gui *Gui) openFile(filename string) error { |