1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-29 22:48:24 +02:00

standardising how list panels deal with cursor movement

This commit is contained in:
Jesse Duffield
2018-12-06 22:18:17 +11:00
parent 99a8b1ae8b
commit ca3afa2a39
9 changed files with 373 additions and 362 deletions

View File

@@ -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)
}