mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-25 17:00:32 -04:00
Hand the whole reflog to GetReflogCommitListDisplayStrings
The reflog commits context slices the visible lines out itself and passes only those, so the function has no way to look at the rest of the list. A following commit needs the oldest entry to work out how much width the date column needs. Take the whole list along with the range to render, the way GetCommitListDisplayStrings already does. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
410d7209b1
commit
0720a05ae4
@@ -27,13 +27,10 @@ func NewReflogCommitsContext(c *ContextCommon) *ReflogCommitsContext {
|
||||
)
|
||||
|
||||
getDisplayStrings := func(startIdx int, endIdx int) [][]string {
|
||||
commits := viewModel.GetItems()
|
||||
if startIdx >= len(commits) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return presentation.GetReflogCommitListDisplayStrings(
|
||||
commits[startIdx:endIdx],
|
||||
viewModel.GetItems(),
|
||||
startIdx,
|
||||
endIdx,
|
||||
c.State().GetRepoState().GetScreenMode() != types.SCREEN_NORMAL,
|
||||
c.Modes().CherryPicking.SelectedHashSet(),
|
||||
c.Modes().Diffing.Ref,
|
||||
|
||||
@@ -12,7 +12,11 @@ import (
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription bool, cherryPickedCommitHashSet *set.Set[string], diffName string, now time.Time, timeFormat string, shortTimeFormat string, parseEmoji bool) [][]string {
|
||||
func GetReflogCommitListDisplayStrings(commits []*models.Commit, startIdx int, endIdx int, fullDescription bool, cherryPickedCommitHashSet *set.Set[string], diffName string, now time.Time, timeFormat string, shortTimeFormat string, parseEmoji bool) [][]string {
|
||||
if startIdx >= len(commits) {
|
||||
return nil
|
||||
}
|
||||
|
||||
var displayFunc func(*models.Commit, reflogCommitDisplayAttributes) []string
|
||||
if fullDescription {
|
||||
displayFunc = getFullDescriptionDisplayStringsForReflogCommit
|
||||
@@ -20,7 +24,7 @@ func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription
|
||||
displayFunc = getDisplayStringsForReflogCommit
|
||||
}
|
||||
|
||||
return lo.Map(commits, func(commit *models.Commit, _ int) []string {
|
||||
return lo.Map(commits[startIdx:endIdx], func(commit *models.Commit, _ int) []string {
|
||||
diffed := commit.Hash() == diffName
|
||||
cherryPicked := cherryPickedCommitHashSet.Includes(commit.Hash())
|
||||
return displayFunc(commit,
|
||||
|
||||
Reference in New Issue
Block a user