about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDaniel Xu <dxu@dxuuu.xyz>2019-08-19 22:10:48 -0700
committerDrew DeVault <sir@cmpwn.com>2019-08-20 16:03:37 +0900
commit6fcc047c3116b6ef59cae39b3beb9e815f9b62a6 (patch)
treebbe1386eae936e6d114f78ada7f23e4cba33ee93
parent334ca89bea38132252d092ad6066af100768eff7 (diff)
downloadaerc-6fcc047c3116b6ef59cae39b3beb9e815f9b62a6.tar.gz
Only compile regex portion of folder filter
The code was trying to compile the `~` as well. In this case, it was
trying to match a literal `~` to the front of the supplied regex.

Fixes: 334ca89bea381 ("folder filter: only assume regex if filter is
~fmt")

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
-rw-r--r--widgets/dirlist.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/widgets/dirlist.go b/widgets/dirlist.go
index 68ba61c..6214c8e 100644
--- a/widgets/dirlist.go
+++ b/widgets/dirlist.go
@@ -165,7 +165,7 @@ func folderMatches(folder string, pattern string) bool {
 		return false
 	}
 	if pattern[0] == '~' {
-		r, err := regexp.Compile(pattern)
+		r, err := regexp.Compile(pattern[1:])
 		if err != nil {
 			return false
 		}
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190