1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-29 22:48:24 +02:00

Use model searching in commits (and sub-commits) view

This commit is contained in:
Stefan Haller
2024-05-31 17:24:50 +02:00
parent 779e6f95a3
commit 6a6316cfb6
75 changed files with 9066 additions and 4175 deletions

View File

@@ -35,6 +35,7 @@ type ListRenderer struct {
numNonModelItems int
viewIndicesByModelIndex []int
modelIndicesByViewIndex []int
columnPositions []int
}
func (self *ListRenderer) GetList() types.IList {
@@ -59,6 +60,10 @@ func (self *ListRenderer) ViewIndexToModelIndex(viewIndex int) int {
return viewIndex
}
func (self *ListRenderer) ColumnPositions() []int {
return self.columnPositions
}
// startIdx and endIdx are view indices, not model indices. If you want to
// render the whole list, pass -1 for both.
func (self *ListRenderer) renderLines(startIdx int, endIdx int) string {
@@ -87,6 +92,7 @@ func (self *ListRenderer) renderLines(startIdx int, endIdx int) string {
lines, columnPositions := utils.RenderDisplayStrings(
self.getDisplayStrings(startModelIdx, endModelIdx),
columnAlignments)
self.columnPositions = columnPositions
lines = self.insertNonModelItems(nonModelItems, endIdx, startIdx, lines, columnPositions)
return strings.Join(lines, "\n")
}