From 48844886a93188fd0e60779b9269755a7d93a8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lilian=20J=C3=B3nsd=C3=B3ttir?= Date: Tue, 30 Jul 2024 18:53:44 -0700 Subject: [PATCH] make filter case insensitive --- internal/interactive/interactive.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/interactive/interactive.go b/internal/interactive/interactive.go index 01f93a3..b4950a3 100644 --- a/internal/interactive/interactive.go +++ b/internal/interactive/interactive.go @@ -594,7 +594,7 @@ func (m *model) applyFilter() { func (m *model) filteredFiles() (filteredFiles files.Files) { for _, file := range m.files { - if fuzzy.Match(m.filter, file.Name()) { + if isMatch(m.filter, file.Name()) { filteredFiles = append(filteredFiles, file) } else { if _, ok := m.selected[file.String()]; ok { @@ -704,3 +704,9 @@ func makeUnselectedStyle() table.Styles { func styleKey(key key.Binding) string { 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) +}