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

Introduce filtered list view model

We're going to start supporting filtering of list views
This commit is contained in:
Jesse Duffield
2023-05-27 14:14:43 +10:00
parent fd861826bc
commit a9e2c8129f
43 changed files with 798 additions and 232 deletions

View File

@ -113,3 +113,14 @@ func MoveElement[T any](slice []T, from int, to int) []T {
return newSlice
}
func ValuesAtIndices[T any](slice []T, indices []int) []T {
result := make([]T, len(indices))
for i, index := range indices {
// gracefully handling the situation where the index is out of bounds
if index < len(slice) {
result[i] = slice[index]
}
}
return result
}