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:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user