summaryrefslogtreecommitdiffstats
path: root/pkg/gui/context/local_commits_context.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui/context/local_commits_context.go')
-rw-r--r--pkg/gui/context/local_commits_context.go22
1 files changed, 3 insertions, 19 deletions
diff --git a/pkg/gui/context/local_commits_context.go b/pkg/gui/context/local_commits_context.go
index 2930348e8..d8d64392c 100644
--- a/pkg/gui/context/local_commits_context.go
+++ b/pkg/gui/context/local_commits_context.go
@@ -3,7 +3,6 @@ package context
import (
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/models"
- "github.com/jesseduffield/lazygit/pkg/gui/context/traits"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
@@ -60,8 +59,7 @@ func (self *LocalCommitsContext) GetSelectedItemId() string {
}
type LocalCommitsViewModel struct {
- *traits.ListCursor
- getModel func() []*models.Commit
+ *BasicViewModel[*models.Commit]
// If this is true we limit the amount of commits we load, for the sake of keeping things fast.
// If the user attempts to scroll past the end of the list, we will load more commits.
@@ -73,12 +71,10 @@ type LocalCommitsViewModel struct {
func NewLocalCommitsViewModel(getModel func() []*models.Commit) *LocalCommitsViewModel {
self := &LocalCommitsViewModel{
- getModel: getModel,
- limitCommits: true,
+ BasicViewModel: NewBasicViewModel(getModel),
+ limitCommits: true,
}
- self.ListCursor = traits.NewListCursor(self)
-
return self
}
@@ -96,18 +92,6 @@ func (self *LocalCommitsContext) GetSelectedRefName() string {
return item.RefName()
}
-func (self *LocalCommitsViewModel) GetItemsLength() int {
- return len(self.getModel())
-}
-
-func (self *LocalCommitsViewModel) GetSelected() *models.Commit {
- if self.GetItemsLength() == 0 {
- return nil
- }
-
- return self.getModel()[self.GetSelectedLineIdx()]
-}
-
func (self *LocalCommitsViewModel) SetLimitCommits(value bool) {
self.limitCommits = value
}