make filter case insensitive
This commit is contained in:
parent
1403f2e62f
commit
48844886a9
|
@ -594,7 +594,7 @@ func (m *model) applyFilter() {
|
||||||
|
|
||||||
func (m *model) filteredFiles() (filteredFiles files.Files) {
|
func (m *model) filteredFiles() (filteredFiles files.Files) {
|
||||||
for _, file := range m.files {
|
for _, file := range m.files {
|
||||||
if fuzzy.Match(m.filter, file.Name()) {
|
if isMatch(m.filter, file.Name()) {
|
||||||
filteredFiles = append(filteredFiles, file)
|
filteredFiles = append(filteredFiles, file)
|
||||||
} else {
|
} else {
|
||||||
if _, ok := m.selected[file.String()]; ok {
|
if _, ok := m.selected[file.String()]; ok {
|
||||||
|
@ -704,3 +704,9 @@ func makeUnselectedStyle() table.Styles {
|
||||||
func styleKey(key key.Binding) string {
|
func styleKey(key key.Binding) string {
|
||||||
return fmt.Sprintf("%s %s", darktext.Render(key.Help().Key), darkertext.Render(key.Help().Desc))
|
return fmt.Sprintf("%s %s", darktext.Render(key.Help().Key), darkertext.Render(key.Help().Desc))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isMatch(pattern, filename string) bool {
|
||||||
|
p := strings.ToLower(pattern)
|
||||||
|
f := strings.ToLower(filename)
|
||||||
|
return fuzzy.Match(p, f)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue