mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 21:42:27 +01:00
add count property to Command's extraInfo to specify whether the command
accepts a count/range
This commit is contained in:
@@ -628,7 +628,8 @@ liberator.History = function () //{{{
|
||||
completions.push([url, title]);
|
||||
}
|
||||
return [0, completions];
|
||||
}
|
||||
},
|
||||
count: true
|
||||
});
|
||||
|
||||
liberator.commands.add(["fo[rward]", "fw"],
|
||||
@@ -675,7 +676,8 @@ liberator.History = function () //{{{
|
||||
completions.push([url, title]);
|
||||
}
|
||||
return [0, completions];
|
||||
}
|
||||
},
|
||||
count: true
|
||||
});
|
||||
|
||||
liberator.commands.add(["hist[ory]", "hs"],
|
||||
|
||||
@@ -79,6 +79,7 @@ liberator.Command = function (specs, description, action, extraInfo) //{{{
|
||||
this.hereDoc = extraInfo.hereDoc || false;
|
||||
this.options = extraInfo.options || [];
|
||||
this.bang = extraInfo.bang || false;
|
||||
this.count = extraInfo.count || false;
|
||||
|
||||
this.isUserCommand = extraInfo.isUserCommand || false;
|
||||
this.replacementText = extraInfo.replacementText || null;
|
||||
|
||||
@@ -492,7 +492,8 @@ const liberator = (function () //{{{
|
||||
return liberator.completion.ex(filter);
|
||||
else
|
||||
return liberator.completion.javascript(filter);
|
||||
}
|
||||
},
|
||||
count: true
|
||||
});
|
||||
|
||||
liberator.commands.add(["ve[rsion]"],
|
||||
@@ -710,34 +711,34 @@ const liberator = (function () //{{{
|
||||
if (/^\s*("|$)/.test(str))
|
||||
return;
|
||||
|
||||
if (!modifiers)
|
||||
modifiers = {};
|
||||
modifiers = modifiers || {};
|
||||
|
||||
var [count, cmd, special, args] = liberator.commands.parseCommand(str.replace(/^'(.*)'$/, "$1"));
|
||||
var command = liberator.commands.get(cmd);
|
||||
let err = null;
|
||||
let [count, cmd, special, args] = liberator.commands.parseCommand(str.replace(/^'(.*)'$/, "$1"));
|
||||
let command = liberator.commands.get(cmd);
|
||||
|
||||
if (command === null)
|
||||
{
|
||||
liberator.echoerr("E492: Not a browser command: " + str);
|
||||
err = "E492: Not a browser command: " + str;
|
||||
liberator.focusContent();
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: need to perform this test? -- djk
|
||||
if (command.action === null)
|
||||
else if (command.action === null)
|
||||
{
|
||||
liberator.echoerr("E666: Internal error: command.action === null");
|
||||
return;
|
||||
err = "E666: Internal error: command.action === null"; // TODO: need to perform this test? -- djk
|
||||
}
|
||||
|
||||
if (special && !command.bang)
|
||||
else if (count != -1 && !command.count)
|
||||
{
|
||||
liberator.echoerr("E477: No ! allowed");
|
||||
return;
|
||||
err = "E481: No range allowed";
|
||||
}
|
||||
else if (special && !command.bang)
|
||||
{
|
||||
err = "E477: No ! allowed";
|
||||
}
|
||||
|
||||
// valid command, call it:
|
||||
command.execute(args, special, count, modifiers);
|
||||
if (!err)
|
||||
command.execute(args, special, count, modifiers);
|
||||
else
|
||||
liberator.echoerr(err);
|
||||
},
|
||||
|
||||
// TODO: move to liberator.buffer.focus()?
|
||||
|
||||
@@ -678,11 +678,14 @@ liberator.Mail = function () //{{{
|
||||
else
|
||||
SelectFolder(folder.URI);
|
||||
},
|
||||
{ completer: function (filter) getFolderCompletions(filter) });
|
||||
{
|
||||
completer: function (filter) getFolderCompletions(filter),
|
||||
count: true
|
||||
});
|
||||
|
||||
liberator.commands.add(["m[essage]"],
|
||||
"Write a new message",
|
||||
function (args, special, count)
|
||||
function (args)
|
||||
{
|
||||
var mailargs = {};
|
||||
mailargs.to = args.arguments.join(", ");
|
||||
|
||||
@@ -390,6 +390,7 @@ liberator.Options = function () //{{{
|
||||
},
|
||||
{
|
||||
bang: true,
|
||||
count: true,
|
||||
completer: function (filter, special, count)
|
||||
{
|
||||
return liberator.commands.get("set").completer(filter, special, count, { scope: liberator.options.OPTION_SCOPE_LOCAL });
|
||||
@@ -405,6 +406,7 @@ liberator.Options = function () //{{{
|
||||
},
|
||||
{
|
||||
bang: true,
|
||||
count: true,
|
||||
completer: function (filter, special, count)
|
||||
{
|
||||
return liberator.commands.get("set").completer(filter, special, count, { scope: liberator.options.OPTION_SCOPE_GLOBAL });
|
||||
|
||||
@@ -345,6 +345,7 @@ liberator.Tabs = function () //{{{
|
||||
},
|
||||
{
|
||||
bang: true,
|
||||
count: true,
|
||||
completer: function (filter) liberator.completion.buffer(filter)
|
||||
});
|
||||
|
||||
@@ -385,7 +386,8 @@ liberator.Tabs = function () //{{{
|
||||
{
|
||||
liberator.tabs.select("-1", true);
|
||||
}
|
||||
});
|
||||
},
|
||||
{ count: true });
|
||||
|
||||
// TODO: "Zero count" if 0 specified as arg
|
||||
liberator.commands.add(["tabn[ext]", "tn[ext]", "bn[ext]"],
|
||||
@@ -423,7 +425,8 @@ liberator.Tabs = function () //{{{
|
||||
{
|
||||
liberator.tabs.select("+1", true);
|
||||
}
|
||||
});
|
||||
},
|
||||
{ count: true });
|
||||
|
||||
liberator.commands.add(["tabr[ewind]", "tabfir[st]", "br[ewind]", "bf[irst]"],
|
||||
"Switch to the first tab",
|
||||
@@ -457,6 +460,7 @@ liberator.Tabs = function () //{{{
|
||||
},
|
||||
{
|
||||
bang: true,
|
||||
count: true,
|
||||
completer: function (filter) liberator.completion.buffer(filter)
|
||||
});
|
||||
|
||||
@@ -528,11 +532,8 @@ liberator.Tabs = function () //{{{
|
||||
|
||||
liberator.commands.add(["tabde[tach]"],
|
||||
"Detach current tab to its own window",
|
||||
function (args, special, count) { liberator.tabs.detachTab(null); },
|
||||
{
|
||||
argCount: "0",
|
||||
bang: true
|
||||
});
|
||||
function () { liberator.tabs.detachTab(null); },
|
||||
{ argCount: "0" });
|
||||
|
||||
liberator.commands.add(["tabd[uplicate]"],
|
||||
"Duplicate current tab",
|
||||
@@ -552,7 +553,8 @@ liberator.Tabs = function () //{{{
|
||||
},
|
||||
{
|
||||
argCount: "0",
|
||||
bang: true
|
||||
bang: true,
|
||||
count: true
|
||||
});
|
||||
}
|
||||
|
||||
@@ -598,7 +600,8 @@ liberator.Tabs = function () //{{{
|
||||
completions.push([url, title]);
|
||||
}
|
||||
return [0, completions];
|
||||
}
|
||||
},
|
||||
count: true
|
||||
});
|
||||
|
||||
liberator.commands.add(["undoa[ll]"],
|
||||
@@ -624,7 +627,8 @@ liberator.Tabs = function () //{{{
|
||||
},
|
||||
{
|
||||
argCount: "0",
|
||||
bang: true
|
||||
bang: true,
|
||||
count: true
|
||||
});
|
||||
|
||||
liberator.commands.add(["wqa[ll]", "wq", "xa[ll]"],
|
||||
|
||||
@@ -345,10 +345,7 @@ liberator.config = { //{{{
|
||||
|
||||
liberator.commands.add(["winc[lose]", "wc[lose]"],
|
||||
"Close window",
|
||||
function ()
|
||||
{
|
||||
window.close();
|
||||
},
|
||||
function () { window.close(); },
|
||||
{ argCount: "0" });
|
||||
|
||||
liberator.commands.add(["wino[pen]", "wo[pen]", "wine[dit]"],
|
||||
|
||||
Reference in New Issue
Block a user