Case insensitive string comparison
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package context
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||
)
|
||||
|
||||
@@ -35,6 +33,10 @@ func (self *FilteredList[T]) ClearFilter() {
|
||||
self.SetFilter("")
|
||||
}
|
||||
|
||||
func (self *FilteredList[T]) IsFiltering() bool {
|
||||
return self.filter != ""
|
||||
}
|
||||
|
||||
func (self *FilteredList[T]) GetFilteredList() []T {
|
||||
if self.filteredIndices == nil {
|
||||
return self.getList()
|
||||
@@ -54,7 +56,7 @@ func (self *FilteredList[T]) applyFilter() {
|
||||
self.filteredIndices = []int{}
|
||||
for i, item := range self.getList() {
|
||||
for _, field := range self.getFilterFields(item) {
|
||||
if strings.Contains(field, self.filter) {
|
||||
if self.match(field, self.filter) {
|
||||
self.filteredIndices = append(self.filteredIndices, i)
|
||||
break
|
||||
}
|
||||
@@ -62,3 +64,7 @@ func (self *FilteredList[T]) applyFilter() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (self *FilteredList[T]) match(haystack string, needle string) bool {
|
||||
return utils.CaseInsensitiveContains(haystack, needle)
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ func NewWorkingTreeContext(c *ContextCommon) *WorkingTreeContext {
|
||||
)
|
||||
|
||||
getDisplayStrings := func(startIdx int, length int) [][]string {
|
||||
c.Log.Warn("in get display strings")
|
||||
lines := presentation.RenderFileTree(viewModel, c.Modes().Diffing.Ref, c.Model().Submodules)
|
||||
return slices.Map(lines, func(line string) []string {
|
||||
return []string{line}
|
||||
|
||||
Reference in New Issue
Block a user