mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-14 18:45:46 +01:00
Provide util.regexpSource to avoid escaping slash when not necessary.
This commit is contained in:
@@ -86,7 +86,7 @@ const AutoCommands = Module("autocommands", {
|
||||
+
|
||||
template.map(items, function (item)
|
||||
<tr>
|
||||
<td> {item.pattern.source}</td>
|
||||
<td> {util.regexpSource(item.pattern)}</td>
|
||||
<td>{item.command}</td>
|
||||
</tr>))
|
||||
}
|
||||
@@ -114,7 +114,7 @@ const AutoCommands = Module("autocommands", {
|
||||
for (let [, autoCmd] in Iterator(autoCmds)) {
|
||||
if (autoCmd.pattern.test(url) ^ !autoCmd.pattern.result) {
|
||||
if (!lastPattern || lastPattern.source != autoCmd.pattern.source)
|
||||
dactyl.echomsg("Executing " + event + " Auto commands for " + autoCmd.pattern.source.quote(), 8);
|
||||
dactyl.echomsg("Executing " + event + " Auto commands for " + util.regexpSource(autoCmd.pattern).quote(), 8);
|
||||
|
||||
lastPattern = autoCmd.pattern;
|
||||
dactyl.echomsg("autocommand " + autoCmd.command, 9);
|
||||
|
||||
@@ -391,7 +391,7 @@ const Option = Class("Option", {
|
||||
re.toString = function () Option.unparseRegexp(this);
|
||||
return re;
|
||||
},
|
||||
unparseRegexp: function (re) re.bang + Option.quote(re.source.replace(/\\(.)/g, function (m, n1) n1 == "/" ? n1 : m), /^!|:/) +
|
||||
unparseRegexp: function (re) re.bang + Option.quote(util.regexpSource(re), /^!|:/) +
|
||||
(typeof re.result === "boolean" ? "" : ":" + Option.quote(re.result)),
|
||||
|
||||
getKey: {
|
||||
|
||||
Reference in New Issue
Block a user