Fix check for invalid filters (#2231)
* Fix check for invalid filters * Update `CHANGELOG.md`
This commit is contained in:
1 parent
887da5d5e4
commit
7776e73334
2 files changed
+10
-5
No files matched your search
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user