about summary refs log tree commit diff stats
path: root/widgets/dirlist.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-08-20 13:04:21 +0900
committerDrew DeVault <sir@cmpwn.com>2019-08-20 13:04:58 +0900
commit334ca89bea38132252d092ad6066af100768eff7 (patch)
tree15e6e21e7e8daedde24d6e7881f2b0bfb8c44273 /widgets/dirlist.go
parent1f5293931adf591fcbeaa9a272d717240da9213a (diff)
downloadaerc-334ca89bea38132252d092ad6066af100768eff7.tar.gz
folder filter: only assume regex if filter is ~fmt
Diffstat (limited to 'widgets/dirlist.go')
-rw-r--r--widgets/dirlist.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/widgets/dirlist.go b/widgets/dirlist.go
index c84f839..68ba61c 100644
--- a/widgets/dirlist.go
+++ b/widgets/dirlist.go
@@ -161,12 +161,17 @@ func (dirlist *DirectoryList) Prev() {
 }
 
 func folderMatches(folder string, pattern string) bool {
-	r, err := regexp.Compile(pattern)
-	if err != nil {
+	if len(pattern) == 0 {
 		return false
 	}
-
-	return r.Match([]byte(folder))
+	if pattern[0] == '~' {
+		r, err := regexp.Compile(pattern)
+		if err != nil {
+			return false
+		}
+		return r.Match([]byte(folder))
+	}
+	return pattern == folder
 }
 
 // filterDirsByFoldersConfig sets dirlist.dirs to the filtered subset of the