summaryrefslogtreecommitdiffstats
path: root/pkg/gui/commits_panel.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui/commits_panel.go')
-rw-r--r--pkg/gui/commits_panel.go14
1 files changed, 4 insertions, 10 deletions
diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go
index 4175918ea..37e234e82 100644
--- a/pkg/gui/commits_panel.go
+++ b/pkg/gui/commits_panel.go
@@ -11,18 +11,12 @@ const COMMIT_THRESHOLD = 200
// list panel functions
func (gui *Gui) getSelectedLocalCommit() *models.Commit {
- selectedLine := gui.State.Panels.Commits.SelectedLineIdx
- if selectedLine == -1 || selectedLine > len(gui.State.Model.Commits)-1 {
- return nil
- }
-
- return gui.State.Model.Commits[selectedLine]
+ return gui.State.Contexts.BranchCommits.GetSelected()
}
func (gui *Gui) onCommitFocus() error {
- state := gui.State.Panels.Commits
- if state.SelectedLineIdx > COMMIT_THRESHOLD && state.LimitCommits {
- state.LimitCommits = false
+ if gui.State.Contexts.BranchCommits.GetSelectedLineIdx() > COMMIT_THRESHOLD && gui.State.LimitCommits {
+ gui.State.LimitCommits = false
go utils.Safe(func() {
if err := gui.refreshCommitsWithLimit(); err != nil {
_ = gui.c.Error(err)
@@ -37,7 +31,7 @@ func (gui *Gui) onCommitFocus() error {
func (gui *Gui) branchCommitsRenderToMain() error {
var task updateTask
- commit := gui.getSelectedLocalCommit()
+ commit := gui.State.Contexts.BranchCommits.GetSelected()
if commit == nil {
task = NewRenderStringTask(gui.c.Tr.NoCommitsThisBranch)
} else {