summaryrefslogtreecommitdiffstats
path: root/pkg/gui
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2023-02-27 09:27:33 +0100
committerStefan Haller <stefan@haller-berlin.de>2023-03-01 09:12:00 +0100
commitde3e4838ad82df8502073a43100126b77ada78db (patch)
treec3e9fe5775284d24bbc15f1f904e645d59acb7cb /pkg/gui
parent6af8f278d07c31a59a7fd7d96b89cb7daf56d2cd (diff)
Store WorkingTreeState in model
This is the working tree state at the time the model commits were loaded. This avoids a visual glitch with the "You Are Here" label appearing at times when it is not supposed to.
Diffstat (limited to 'pkg/gui')
-rw-r--r--pkg/gui/list_context_config.go2
-rw-r--r--pkg/gui/refresh.go2
-rw-r--r--pkg/gui/types/common.go8
3 files changed, 8 insertions, 4 deletions
diff --git a/pkg/gui/list_context_config.go b/pkg/gui/list_context_config.go
index de0ef26ac..71308f90d 100644
--- a/pkg/gui/list_context_config.go
+++ b/pkg/gui/list_context_config.go
@@ -120,7 +120,7 @@ func (gui *Gui) branchCommitsListContext() *context.LocalCommitsContext {
}
}
- showYouAreHereLabel := gui.git.Status.WorkingTreeState() == enums.REBASE_MODE_REBASING
+ showYouAreHereLabel := gui.State.Model.WorkingTreeStateAtLastCommitRefresh == enums.REBASE_MODE_REBASING
return presentation.GetCommitListDisplayStrings(
gui.Common,
diff --git a/pkg/gui/refresh.go b/pkg/gui/refresh.go
index 77dea9e86..7f7dc4829 100644
--- a/pkg/gui/refresh.go
+++ b/pkg/gui/refresh.go
@@ -236,6 +236,7 @@ func (gui *Gui) refreshCommitsWithLimit() error {
return err
}
gui.State.Model.Commits = commits
+ gui.State.Model.WorkingTreeStateAtLastCommitRefresh = gui.git.Status.WorkingTreeState()
return gui.c.PostRefreshUpdate(gui.State.Contexts.LocalCommits)
}
@@ -264,6 +265,7 @@ func (gui *Gui) refreshRebaseCommits() error {
return err
}
gui.State.Model.Commits = updatedCommits
+ gui.State.Model.WorkingTreeStateAtLastCommitRefresh = gui.git.Status.WorkingTreeState()
return gui.c.PostRefreshUpdate(gui.State.Contexts.LocalCommits)
}
diff --git a/pkg/gui/types/common.go b/pkg/gui/types/common.go
index ab8f6b2b8..a55ead4da 100644
--- a/pkg/gui/types/common.go
+++ b/pkg/gui/types/common.go
@@ -4,6 +4,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
+ "github.com/jesseduffield/lazygit/pkg/commands/types/enums"
"github.com/jesseduffield/lazygit/pkg/common"
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/sasha-s/go-deadlock"
@@ -154,9 +155,10 @@ type Model struct {
// one and the same
ReflogCommits []*models.Commit
- BisectInfo *git_commands.BisectInfo
- RemoteBranches []*models.RemoteBranch
- Tags []*models.Tag
+ BisectInfo *git_commands.BisectInfo
+ WorkingTreeStateAtLastCommitRefresh enums.RebaseMode
+ RemoteBranches []*models.RemoteBranch
+ Tags []*models.Tag
// for displaying suggestions while typing in a file name
FilesTrie *patricia.Trie