1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Call getDisplayStrings with a valid range of model indices

It's nicer if clients can rely on the indices being valid, and don't have to
clamp themselves.
This commit is contained in:
Stefan Haller
2023-08-18 16:50:07 +02:00
parent 473d989cde
commit 297a020abf
3 changed files with 8 additions and 9 deletions

View File

@ -68,11 +68,10 @@ func GetCommitListDisplayStrings(
return nil
}
end := utils.Min(endIdx, len(commits))
// this is where my non-TODO commits begin
rebaseOffset := utils.Min(indexOfFirstNonTODOCommit(commits), end)
rebaseOffset := utils.Min(indexOfFirstNonTODOCommit(commits), endIdx)
filteredCommits := commits[startIdx:end]
filteredCommits := commits[startIdx:endIdx]
bisectBounds := getbisectBounds(commits, bisectInfo)
@ -85,8 +84,8 @@ func GetCommitListDisplayStrings(
pipeSets := loadPipesets(commits[rebaseOffset:])
pipeSetOffset := utils.Max(startIdx-rebaseOffset, 0)
graphPipeSets := pipeSets[pipeSetOffset:utils.Max(end-rebaseOffset, 0)]
graphCommits := commits[graphOffset:end]
graphPipeSets := pipeSets[pipeSetOffset:utils.Max(endIdx-rebaseOffset, 0)]
graphCommits := commits[graphOffset:endIdx]
graphLines := graph.RenderAux(
graphPipeSets,
graphCommits,