1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-15 13:45:48 +01:00

Precompute completion string matching function.

This commit is contained in:
Kris Maglione
2010-09-17 06:15:13 -04:00
parent 8b0d9586b2
commit a5213c3760
14 changed files with 68 additions and 63 deletions

View File

@@ -699,12 +699,11 @@ const Util = Module("Util", {
if (!re.global)
re = RegExp(re.source || re, "g");
let match, start = 0, res = [];
while ((match = re.exec(str)) && --limit && match[0].length) {
while (--limit && (match = re.exec(str)) && match[0].length) {
res.push(str.substring(start, match.index));
start = match.index + match[0].length;
}
if (limit)
res.push(str.substring(start));
res.push(str.substring(start));
return res;
},