diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-12-06 22:18:17 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-12-08 11:51:47 +1100 |
commit | ca3afa2a3905365ec79624e0c9b08865e9ab27ae (patch) | |
tree | 47add13ed3819ddc9ed89c16c12cb9aab22ad1cd /pkg/gui/gui.go | |
parent | 99a8b1ae8bb93565df8acbe168749278dc768979 (diff) |
standardising how list panels deal with cursor movement
Diffstat (limited to 'pkg/gui/gui.go')
-rw-r--r-- | pkg/gui/gui.go | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 1af3a5e1f..6a7eaaf98 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -95,12 +95,17 @@ type stashPanelState struct { SelectedLine int } +type menuPanelState struct { + SelectedLine int +} + type panelStates struct { Files *filePanelState Staging *stagingPanelState Branches *branchPanelState Commits *commitPanelState Stash *stashPanelState + Menu *menuPanelState } type guiState struct { @@ -137,6 +142,7 @@ func NewGui(log *logrus.Entry, gitCommand *commands.GitCommand, oSCommand *comma Branches: &branchPanelState{SelectedLine: 0}, Commits: &commitPanelState{SelectedLine: -1}, Stash: &stashPanelState{SelectedLine: -1}, + Menu: &menuPanelState{SelectedLine: 0}, }, } @@ -359,12 +365,12 @@ func (gui *Gui) layout(g *gocui.Gui) error { } gui.g.SetCurrentView(filesView.Name()) - gui.refreshFiles(g) - gui.refreshBranches(g) - gui.refreshCommits(g) - gui.refreshStashEntries(g) - if err := gui.renderGlobalOptions(g); err != nil { - return err + + gui.refreshSidePanels(gui.g) + if gui.g.CurrentView().Name() != "menu" { + if err := gui.renderGlobalOptions(g); err != nil { + return err + } } if err := gui.switchFocus(g, nil, filesView); err != nil { return err @@ -388,6 +394,9 @@ func (gui *Gui) layout(g *gocui.Gui) error { } } + // TODO: comment-out + gui.Log.Info(utils.AsJson(gui.State)) + return gui.resizeCurrentPopupPanel(g) } |