diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-02-06 15:54:26 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-17 19:13:40 +1100 |
commit | 722410aded4e3d14356c7ab94bfa15abe10359fa (patch) | |
tree | 8e8a57503b0b57bccca5fa8cd146bc699960033f /pkg/gui/context | |
parent | b93b8cc00a2f2ea339b1ecdbc380320556490d3b (diff) |
refactor controllers
Diffstat (limited to 'pkg/gui/context')
-rw-r--r-- | pkg/gui/context/branches_context.go | 2 | ||||
-rw-r--r-- | pkg/gui/context/commit_files_context.go | 2 | ||||
-rw-r--r-- | pkg/gui/context/list_context_trait.go | 2 | ||||
-rw-r--r-- | pkg/gui/context/local_commits_context.go | 18 | ||||
-rw-r--r-- | pkg/gui/context/menu_context.go | 2 | ||||
-rw-r--r-- | pkg/gui/context/reflog_commits_context.go | 2 | ||||
-rw-r--r-- | pkg/gui/context/remote_branches_context.go | 2 | ||||
-rw-r--r-- | pkg/gui/context/remotes_context.go | 2 | ||||
-rw-r--r-- | pkg/gui/context/stash_context.go | 2 | ||||
-rw-r--r-- | pkg/gui/context/sub_commits_context.go | 2 | ||||
-rw-r--r-- | pkg/gui/context/submodules_context.go | 2 | ||||
-rw-r--r-- | pkg/gui/context/suggestions_context.go | 2 | ||||
-rw-r--r-- | pkg/gui/context/tags_context.go | 2 | ||||
-rw-r--r-- | pkg/gui/context/working_tree_context.go | 2 |
14 files changed, 29 insertions, 15 deletions
diff --git a/pkg/gui/context/branches_context.go b/pkg/gui/context/branches_context.go index 4b82844f4..146810a86 100644 --- a/pkg/gui/context/branches_context.go +++ b/pkg/gui/context/branches_context.go @@ -23,7 +23,7 @@ func NewBranchesContext( onRenderToMain func(...types.OnFocusOpts) error, onFocusLost func() error, - c *types.ControllerCommon, + c *types.HelperCommon, ) *BranchesContext { viewModel := NewBranchesViewModel(getModel) diff --git a/pkg/gui/context/commit_files_context.go b/pkg/gui/context/commit_files_context.go index 1c555387b..8f9bd91f7 100644 --- a/pkg/gui/context/commit_files_context.go +++ b/pkg/gui/context/commit_files_context.go @@ -23,7 +23,7 @@ func NewCommitFilesContext( onRenderToMain func(...types.OnFocusOpts) error, onFocusLost func() error, - c *types.ControllerCommon, + c *types.HelperCommon, ) *CommitFilesContext { viewModel := filetree.NewCommitFileTreeViewModel(getModel, c.Log, c.UserConfig.Gui.ShowFileTree) diff --git a/pkg/gui/context/list_context_trait.go b/pkg/gui/context/list_context_trait.go index b716bb25e..6deb5dfc1 100644 --- a/pkg/gui/context/list_context_trait.go +++ b/pkg/gui/context/list_context_trait.go @@ -10,7 +10,7 @@ import ( type ListContextTrait struct { types.Context - c *types.ControllerCommon + c *types.HelperCommon list types.IList viewTrait *ViewTrait getDisplayStrings func(startIdx int, length int) [][]string diff --git a/pkg/gui/context/local_commits_context.go b/pkg/gui/context/local_commits_context.go index 533d97cb2..9da4721e3 100644 --- a/pkg/gui/context/local_commits_context.go +++ b/pkg/gui/context/local_commits_context.go @@ -23,7 +23,7 @@ func NewLocalCommitsContext( onRenderToMain func(...types.OnFocusOpts) error, onFocusLost func() error, - c *types.ControllerCommon, + c *types.HelperCommon, ) *LocalCommitsContext { viewModel := NewLocalCommitsViewModel(getModel) @@ -61,8 +61,14 @@ func (self *LocalCommitsContext) GetSelectedItemId() string { type LocalCommitsViewModel struct { *traits.ListCursor + getModel func() []*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. limitCommits bool - getModel func() []*models.Commit + + // If this is true we'll use git log --all when fetching the commits. + showWholeGitGraph bool } func NewLocalCommitsViewModel(getModel func() []*models.Commit) *LocalCommitsViewModel { @@ -95,3 +101,11 @@ func (self *LocalCommitsViewModel) SetLimitCommits(value bool) { func (self *LocalCommitsViewModel) GetLimitCommits() bool { return self.limitCommits } + +func (self *LocalCommitsViewModel) SetShowWholeGitGraph(value bool) { + self.showWholeGitGraph = value +} + +func (self *LocalCommitsViewModel) GetShowWholeGitGraph() bool { + return self.showWholeGitGraph +} diff --git a/pkg/gui/context/menu_context.go b/pkg/gui/context/menu_context.go index 47c6b885f..2e75ba25a 100644 --- a/pkg/gui/context/menu_context.go +++ b/pkg/gui/context/menu_context.go @@ -21,7 +21,7 @@ func NewMenuContext( onRenderToMain func(...types.OnFocusOpts) error, onFocusLost func() error, - c *types.ControllerCommon, + c *types.HelperCommon, getOptionsMap func() map[string]string, ) *MenuContext { viewModel := NewMenuViewModel() diff --git a/pkg/gui/context/reflog_commits_context.go b/pkg/gui/context/reflog_commits_context.go index e3130c251..4a53fe393 100644 --- a/pkg/gui/context/reflog_commits_context.go +++ b/pkg/gui/context/reflog_commits_context.go @@ -23,7 +23,7 @@ func NewReflogCommitsContext( onRenderToMain func(...types.OnFocusOpts) error, onFocusLost func() error, - c *types.ControllerCommon, + c *types.HelperCommon, ) *ReflogCommitsContext { viewModel := NewReflogCommitsViewModel(getModel) diff --git a/pkg/gui/context/remote_branches_context.go b/pkg/gui/context/remote_branches_context.go index 6ec5f887b..c851c96ac 100644 --- a/pkg/gui/context/remote_branches_context.go +++ b/pkg/gui/context/remote_branches_context.go @@ -23,7 +23,7 @@ func NewRemoteBranchesContext( onRenderToMain func(...types.OnFocusOpts) error, onFocusLost func() error, - c *types.ControllerCommon, + c *types.HelperCommon, ) *RemoteBranchesContext { viewModel := NewRemoteBranchesViewModel(getModel) diff --git a/pkg/gui/context/remotes_context.go b/pkg/gui/context/remotes_context.go index 28d0db20a..2b6afdeb5 100644 --- a/pkg/gui/context/remotes_context.go +++ b/pkg/gui/context/remotes_context.go @@ -23,7 +23,7 @@ func NewRemotesContext( onRenderToMain func(...types.OnFocusOpts) error, onFocusLost func() error, - c *types.ControllerCommon, + c *types.HelperCommon, ) *RemotesContext { viewModel := NewRemotesViewModel(getModel) diff --git a/pkg/gui/context/stash_context.go b/pkg/gui/context/stash_context.go index 9c22e7b06..95efeaef1 100644 --- a/pkg/gui/context/stash_context.go +++ b/pkg/gui/context/stash_context.go @@ -23,7 +23,7 @@ func NewStashContext( onRenderToMain func(...types.OnFocusOpts) error, onFocusLost func() error, - c *types.ControllerCommon, + c *types.HelperCommon, ) *StashContext { viewModel := NewStashViewModel(getModel) diff --git a/pkg/gui/context/sub_commits_context.go b/pkg/gui/context/sub_commits_context.go index aed0e01a2..10c2cf41a 100644 --- a/pkg/gui/context/sub_commits_context.go +++ b/pkg/gui/context/sub_commits_context.go @@ -23,7 +23,7 @@ func NewSubCommitsContext( onRenderToMain func(...types.OnFocusOpts) error, onFocusLost func() error, - c *types.ControllerCommon, + c *types.HelperCommon, ) *SubCommitsContext { viewModel := NewSubCommitsViewModel(getModel) diff --git a/pkg/gui/context/submodules_context.go b/pkg/gui/context/submodules_context.go index c58755985..2bf5fe274 100644 --- a/pkg/gui/context/submodules_context.go +++ b/pkg/gui/context/submodules_context.go @@ -23,7 +23,7 @@ func NewSubmodulesContext( onRenderToMain func(...types.OnFocusOpts) error, onFocusLost func() error, - c *types.ControllerCommon, + c *types.HelperCommon, ) *SubmodulesContext { viewModel := NewSubmodulesViewModel(getModel) diff --git a/pkg/gui/context/suggestions_context.go b/pkg/gui/context/suggestions_context.go index 5320e40c6..6c565eedf 100644 --- a/pkg/gui/context/suggestions_context.go +++ b/pkg/gui/context/suggestions_context.go @@ -22,7 +22,7 @@ func NewSuggestionsContext( onRenderToMain func(...types.OnFocusOpts) error, onFocusLost func() error, - c *types.ControllerCommon, + c *types.HelperCommon, ) *SuggestionsContext { viewModel := NewSuggestionsViewModel(getModel) diff --git a/pkg/gui/context/tags_context.go b/pkg/gui/context/tags_context.go index 169a4989d..aa6211f40 100644 --- a/pkg/gui/context/tags_context.go +++ b/pkg/gui/context/tags_context.go @@ -23,7 +23,7 @@ func NewTagsContext( onRenderToMain func(...types.OnFocusOpts) error, onFocusLost func() error, - c *types.ControllerCommon, + c *types.HelperCommon, ) *TagsContext { viewModel := NewTagsViewModel(getModel) diff --git a/pkg/gui/context/working_tree_context.go b/pkg/gui/context/working_tree_context.go index c1021ba23..ae647afb3 100644 --- a/pkg/gui/context/working_tree_context.go +++ b/pkg/gui/context/working_tree_context.go @@ -23,7 +23,7 @@ func NewWorkingTreeContext( onRenderToMain func(...types.OnFocusOpts) error, onFocusLost func() error, - c *types.ControllerCommon, + c *types.HelperCommon, ) *WorkingTreeContext { viewModel := filetree.NewFileTreeViewModel(getModel, c.Log, c.UserConfig.Gui.ShowFileTree) |