diff --git a/CHANGELOG.md b/CHANGELOG.md index d8702551..19d5e8a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), - A bug where an empty `custom` info property would still take up space is now fixed (#2208). - A bug where setting `drawbox` could lead to scrolling outside the view is now fixed (#2210) (#2218). - The preview cache is now not cleared when setting `ratios` to its current value (#2218). +- Filtering is fixed when using special characters in the search pattern if the `filtermethod` is `text` (#2231). ## [r38](https://github.com/gokcehan/lf/releases/tag/r38) diff --git a/nav.go b/nav.go index f4d0753e..743f6957 100644 --- a/nav.go +++ b/nav.go @@ -958,14 +958,18 @@ func (nav *nav) sort() { func (nav *nav) setFilter(filter []string) error { newfilter := []string{} for _, tok := range filter { - _, err := filepath.Match(tok, "a") - if err != nil { + if tok == "" { + continue + } + + // check if filter is valid by applying it to a dummy string + if _, err := searchMatch("a", strings.TrimPrefix(tok, "!"), gOpts.filtermethod); err != nil { return err } - if tok != "" { - newfilter = append(newfilter, tok) - } + + newfilter = append(newfilter, tok) } + dir := nav.currDir() dir.filter = newfilter