mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 22:02:26 +01:00
In delmarks, change let variable name to prevent namespace-related error (bug #126).
See http://vimperator.org/trac/ticket/126 Using... function (args) { let args = args.string; ... was causing Firefox to complain that args was undefined. Changing the "let" to "var" or changing the names of the variables (e.g., changing "function (args)" to "function (arg)") fixes the problem. IMO, this appears to be a bug in Firefox. The short fix would be to change the formal argument from "args" to "arg." However, that would make delmarks' implementation different from all the rest. So changed "let args" to "let argstring" and adjusted throughout the function.
This commit is contained in:
@@ -1614,20 +1614,20 @@ function Marks() //{{{
|
|||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
let special = args.bang;
|
let special = args.bang;
|
||||||
let args = args.string;
|
let argstring = args.string;
|
||||||
|
|
||||||
if (!special && !args)
|
if (!special && !argstring)
|
||||||
{
|
{
|
||||||
liberator.echoerr("E471: Argument required");
|
liberator.echoerr("E471: Argument required");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (special && args)
|
if (special && argstring)
|
||||||
{
|
{
|
||||||
liberator.echoerr("E474: Invalid argument");
|
liberator.echoerr("E474: Invalid argument");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let matches;
|
let matches;
|
||||||
if (matches = args.match(/(?:(?:^|[^a-zA-Z0-9])-|-(?:$|[^a-zA-Z0-9])|[^a-zA-Z0-9 -]).*/))
|
if (matches = argstring.match(/(?:(?:^|[^a-zA-Z0-9])-|-(?:$|[^a-zA-Z0-9])|[^a-zA-Z0-9 -]).*/))
|
||||||
{
|
{
|
||||||
// NOTE: this currently differs from Vim's behavior which
|
// NOTE: this currently differs from Vim's behavior which
|
||||||
// deletes any valid marks in the arg list, up to the first
|
// deletes any valid marks in the arg list, up to the first
|
||||||
@@ -1636,7 +1636,7 @@ function Marks() //{{{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// check for illegal ranges - only allow a-z A-Z 0-9
|
// check for illegal ranges - only allow a-z A-Z 0-9
|
||||||
if (matches = args.match(/[a-zA-Z0-9]-[a-zA-Z0-9]/g))
|
if (matches = argstring.match(/[a-zA-Z0-9]-[a-zA-Z0-9]/g))
|
||||||
{
|
{
|
||||||
for (let i = 0; i < matches.length; i++)
|
for (let i = 0; i < matches.length; i++)
|
||||||
{
|
{
|
||||||
@@ -1647,13 +1647,13 @@ function Marks() //{{{
|
|||||||
/[0-9]/.test(start) != /[0-9]/.test(end) ||
|
/[0-9]/.test(start) != /[0-9]/.test(end) ||
|
||||||
start > end)
|
start > end)
|
||||||
{
|
{
|
||||||
liberator.echoerr("E475: Invalid argument: " + args.match(matches[i] + ".*")[0]);
|
liberator.echoerr("E475: Invalid argument: " + argstring.match(matches[i] + ".*")[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
marks.remove(args, special);
|
marks.remove(argstring, special);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
bang: true,
|
bang: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user