1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

refactor the way we render lists

This commit is contained in:
Jesse Duffield
2020-02-25 20:55:36 +11:00
parent 9fd9fd6816
commit f94d0be2c9
29 changed files with 250 additions and 545 deletions

View File

@ -24,6 +24,7 @@ import (
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/gui/presentation"
"github.com/jesseduffield/lazygit/pkg/i18n"
"github.com/jesseduffield/lazygit/pkg/tasks"
"github.com/jesseduffield/lazygit/pkg/theme"
@ -270,7 +271,7 @@ func NewGui(log *logrus.Entry, gitCommand *commands.GitCommand, oSCommand *comma
func (gui *Gui) nextScreenMode(g *gocui.Gui, v *gocui.View) error {
gui.State.ScreenMode = utils.NextIntInCycle([]int{SCREEN_NORMAL, SCREEN_HALF, SCREEN_FULL}, gui.State.ScreenMode)
// commits render differently depending on whether we're in fullscreen more or not
if err := gui.renderBranchCommitsWithSelection(); err != nil {
if err := gui.refreshCommitsViewWithSelection(); err != nil {
return err
}
@ -280,7 +281,7 @@ func (gui *Gui) nextScreenMode(g *gocui.Gui, v *gocui.View) error {
func (gui *Gui) prevScreenMode(g *gocui.Gui, v *gocui.View) error {
gui.State.ScreenMode = utils.PrevIntInCycle([]int{SCREEN_NORMAL, SCREEN_HALF, SCREEN_FULL}, gui.State.ScreenMode)
// commits render differently depending on whether we're in fullscreen more or not
if err := gui.renderBranchCommitsWithSelection(); err != nil {
if err := gui.refreshCommitsViewWithSelection(); err != nil {
return err
}
@ -382,10 +383,8 @@ func (gui *Gui) onFocusLost(v *gocui.View, newView *gocui.View) error {
case "branches":
if v.Context == "local-branches" {
// This stops the branches panel from showing the upstream/downstream changes to the selected branch, when it loses focus
// inside renderListPanel it checks to see if the panel has focus
if err := gui.renderListPanel(gui.getBranchesView(), gui.State.Branches); err != nil {
return err
}
displayStrings := presentation.GetBranchListDisplayStrings(gui.State.Branches, false, -1)
gui.renderDisplayStrings(gui.getBranchesView(), displayStrings)
}
case "main":
// if we have lost focus to a first-class panel, we need to do some cleanup