diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-08-17 21:52:29 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2023-08-28 14:21:06 +0200 |
commit | 061bfce835aed7e78c58bf40c567aa5dffc27e0c (patch) | |
tree | bfcfc6db0ce2f542175a39a49e738ae544348fdd /pkg/gui/context | |
parent | 996e30e5d98ef774212ce69dbcc6103c3e4e64f8 (diff) |
Change length parameter of getDisplayStrings to endIdx
It's more natural to work with this way, as we will see later in this branch.
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 | 4 | ||||
-rw-r--r-- | pkg/gui/context/local_commits_context.go | 4 | ||||
-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 | 4 | ||||
-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 | ||||
-rw-r--r-- | pkg/gui/context/worktrees_context.go | 2 |
15 files changed, 18 insertions, 18 deletions
diff --git a/pkg/gui/context/branches_context.go b/pkg/gui/context/branches_context.go index e4806165f..bf90446ae 100644 --- a/pkg/gui/context/branches_context.go +++ b/pkg/gui/context/branches_context.go @@ -24,7 +24,7 @@ func NewBranchesContext(c *ContextCommon) *BranchesContext { }, ) - getDisplayStrings := func(startIdx int, length int) [][]string { + getDisplayStrings := func(_ int, _ int) [][]string { return presentation.GetBranchListDisplayStrings( viewModel.GetItems(), c.State().GetRepoState().GetScreenMode() != types.SCREEN_NORMAL, diff --git a/pkg/gui/context/commit_files_context.go b/pkg/gui/context/commit_files_context.go index 035230e9d..2229cf2d6 100644 --- a/pkg/gui/context/commit_files_context.go +++ b/pkg/gui/context/commit_files_context.go @@ -28,7 +28,7 @@ func NewCommitFilesContext(c *ContextCommon) *CommitFilesContext { c.UserConfig.Gui.ShowFileTree, ) - getDisplayStrings := func(startIdx int, length int) [][]string { + getDisplayStrings := func(_ int, _ int) [][]string { if viewModel.Len() == 0 { return [][]string{{style.FgRed.Sprint("(none)")}} } diff --git a/pkg/gui/context/list_context_trait.go b/pkg/gui/context/list_context_trait.go index 900be019c..9942fffe0 100644 --- a/pkg/gui/context/list_context_trait.go +++ b/pkg/gui/context/list_context_trait.go @@ -12,7 +12,7 @@ type ListContextTrait struct { c *ContextCommon list types.IList - getDisplayStrings func(startIdx int, length int) [][]string + getDisplayStrings func(startIdx int, endIdx int) [][]string // Alignment for each column. If nil, the default is left alignment getColumnAlignments func() []utils.Alignment // Some contexts, like the commit context, will highlight the path from the selected commit @@ -59,7 +59,7 @@ func (self *ListContextTrait) FocusLine() { func (self *ListContextTrait) refreshViewport() { startIdx, length := self.GetViewTrait().ViewPortYBounds() - displayStrings := self.getDisplayStrings(startIdx, length) + displayStrings := self.getDisplayStrings(startIdx, startIdx+length) content := utils.RenderDisplayStrings(displayStrings, nil) self.GetViewTrait().SetViewPortContent(content) } diff --git a/pkg/gui/context/local_commits_context.go b/pkg/gui/context/local_commits_context.go index f8f7848f2..e34e04249 100644 --- a/pkg/gui/context/local_commits_context.go +++ b/pkg/gui/context/local_commits_context.go @@ -27,7 +27,7 @@ func NewLocalCommitsContext(c *ContextCommon) *LocalCommitsContext { c, ) - getDisplayStrings := func(startIdx int, length int) [][]string { + getDisplayStrings := func(startIdx int, endIdx int) [][]string { selectedCommitSha := "" if c.CurrentContext().GetKey() == LOCAL_COMMITS_CONTEXT_KEY { @@ -56,7 +56,7 @@ func NewLocalCommitsContext(c *ContextCommon) *LocalCommitsContext { c.UserConfig.Git.ParseEmoji, selectedCommitSha, startIdx, - length, + endIdx, shouldShowGraph(c), c.Model().BisectInfo, showYouAreHereLabel, diff --git a/pkg/gui/context/menu_context.go b/pkg/gui/context/menu_context.go index 353f3d386..c9dda81f4 100644 --- a/pkg/gui/context/menu_context.go +++ b/pkg/gui/context/menu_context.go @@ -79,7 +79,7 @@ func (self *MenuViewModel) SetMenuItems(items []*types.MenuItem, columnAlignment } // TODO: move into presentation package -func (self *MenuViewModel) GetDisplayStrings(_startIdx int, _length int) [][]string { +func (self *MenuViewModel) GetDisplayStrings(_ int, _ int) [][]string { menuItems := self.FilteredListViewModel.GetItems() showKeys := lo.SomeBy(menuItems, func(item *types.MenuItem) bool { return item.Key != nil diff --git a/pkg/gui/context/reflog_commits_context.go b/pkg/gui/context/reflog_commits_context.go index 5038b1870..baaa1e154 100644 --- a/pkg/gui/context/reflog_commits_context.go +++ b/pkg/gui/context/reflog_commits_context.go @@ -26,7 +26,7 @@ func NewReflogCommitsContext(c *ContextCommon) *ReflogCommitsContext { }, ) - getDisplayStrings := func(startIdx int, length int) [][]string { + getDisplayStrings := func(_ int, _ int) [][]string { return presentation.GetReflogCommitListDisplayStrings( viewModel.GetItems(), c.State().GetRepoState().GetScreenMode() != types.SCREEN_NORMAL, diff --git a/pkg/gui/context/remote_branches_context.go b/pkg/gui/context/remote_branches_context.go index fbc91f352..ef519ab71 100644 --- a/pkg/gui/context/remote_branches_context.go +++ b/pkg/gui/context/remote_branches_context.go @@ -27,7 +27,7 @@ func NewRemoteBranchesContext( }, ) - getDisplayStrings := func(startIdx int, length int) [][]string { + getDisplayStrings := func(_ int, _ int) [][]string { return presentation.GetRemoteBranchListDisplayStrings(viewModel.GetItems(), c.Modes().Diffing.Ref) } diff --git a/pkg/gui/context/remotes_context.go b/pkg/gui/context/remotes_context.go index f5e2a97ab..2720d139e 100644 --- a/pkg/gui/context/remotes_context.go +++ b/pkg/gui/context/remotes_context.go @@ -24,7 +24,7 @@ func NewRemotesContext(c *ContextCommon) *RemotesContext { }, ) - getDisplayStrings := func(startIdx int, length int) [][]string { + getDisplayStrings := func(_ int, _ int) [][]string { return presentation.GetRemoteListDisplayStrings(viewModel.GetItems(), c.Modes().Diffing.Ref) } diff --git a/pkg/gui/context/stash_context.go b/pkg/gui/context/stash_context.go index 7bd4740f8..01768c6d1 100644 --- a/pkg/gui/context/stash_context.go +++ b/pkg/gui/context/stash_context.go @@ -26,7 +26,7 @@ func NewStashContext( }, ) - getDisplayStrings := func(startIdx int, length int) [][]string { + getDisplayStrings := func(_ int, _ int) [][]string { return presentation.GetStashEntryListDisplayStrings(viewModel.GetItems(), c.Modes().Diffing.Ref) } diff --git a/pkg/gui/context/sub_commits_context.go b/pkg/gui/context/sub_commits_context.go index 2643d294b..048d91f0e 100644 --- a/pkg/gui/context/sub_commits_context.go +++ b/pkg/gui/context/sub_commits_context.go @@ -36,7 +36,7 @@ func NewSubCommitsContext( limitCommits: true, } - getDisplayStrings := func(startIdx int, length int) [][]string { + getDisplayStrings := func(startIdx int, endIdx int) [][]string { // This can happen if a sub-commits view is asked to be rerendered while // it is invisble; for example when switching screen modes, which // rerenders all views. @@ -72,7 +72,7 @@ func NewSubCommitsContext( c.UserConfig.Git.ParseEmoji, selectedCommitSha, startIdx, - length, + endIdx, shouldShowGraph(c), git_commands.NewNullBisectInfo(), false, diff --git a/pkg/gui/context/submodules_context.go b/pkg/gui/context/submodules_context.go index e97fa4f5c..f5018987d 100644 --- a/pkg/gui/context/submodules_context.go +++ b/pkg/gui/context/submodules_context.go @@ -21,7 +21,7 @@ func NewSubmodulesContext(c *ContextCommon) *SubmodulesContext { }, ) - getDisplayStrings := func(startIdx int, length int) [][]string { + getDisplayStrings := func(_ int, _ int) [][]string { return presentation.GetSubmoduleListDisplayStrings(viewModel.GetItems()) } diff --git a/pkg/gui/context/suggestions_context.go b/pkg/gui/context/suggestions_context.go index d8b650642..c4442400c 100644 --- a/pkg/gui/context/suggestions_context.go +++ b/pkg/gui/context/suggestions_context.go @@ -36,7 +36,7 @@ func NewSuggestionsContext( return state.Suggestions } - getDisplayStrings := func(startIdx int, length int) [][]string { + getDisplayStrings := func(_ int, _ int) [][]string { return presentation.GetSuggestionListDisplayStrings(state.Suggestions) } diff --git a/pkg/gui/context/tags_context.go b/pkg/gui/context/tags_context.go index 95b845a28..777a68099 100644 --- a/pkg/gui/context/tags_context.go +++ b/pkg/gui/context/tags_context.go @@ -26,7 +26,7 @@ func NewTagsContext( }, ) - getDisplayStrings := func(startIdx int, length int) [][]string { + getDisplayStrings := func(_ int, _ int) [][]string { return presentation.GetTagListDisplayStrings(viewModel.GetItems(), c.Modes().Diffing.Ref) } diff --git a/pkg/gui/context/working_tree_context.go b/pkg/gui/context/working_tree_context.go index 390c03b33..36b1f1adb 100644 --- a/pkg/gui/context/working_tree_context.go +++ b/pkg/gui/context/working_tree_context.go @@ -23,7 +23,7 @@ func NewWorkingTreeContext(c *ContextCommon) *WorkingTreeContext { c.UserConfig.Gui.ShowFileTree, ) - getDisplayStrings := func(startIdx int, length int) [][]string { + getDisplayStrings := func(_ int, _ int) [][]string { lines := presentation.RenderFileTree(viewModel, c.Modes().Diffing.Ref, c.Model().Submodules) return lo.Map(lines, func(line string, _ int) []string { return []string{line} diff --git a/pkg/gui/context/worktrees_context.go b/pkg/gui/context/worktrees_context.go index 055467b74..a5a30e990 100644 --- a/pkg/gui/context/worktrees_context.go +++ b/pkg/gui/context/worktrees_context.go @@ -21,7 +21,7 @@ func NewWorktreesContext(c *ContextCommon) *WorktreesContext { }, ) - getDisplayStrings := func(startIdx int, length int) [][]string { + getDisplayStrings := func(_ int, _ int) [][]string { return presentation.GetWorktreeDisplayStrings( c.Tr, viewModel.GetFilteredList(), |