mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-15 06:15:48 +01:00
Remove the command Args dependency from a few straggling completers.
--HG-- extra : rebase_source : 12e642050a248dc0a33164d6757e925c9339a760
This commit is contained in:
@@ -215,12 +215,9 @@ const Abbreviations = Module("abbreviations", {
|
||||
}, {
|
||||
}, {
|
||||
completion: function () {
|
||||
// TODO: shouldn't all of these have a standard signature (context, args, ...)? --djk
|
||||
completion.abbreviation = function abbreviation(context, args, modes) {
|
||||
if (args.completeArg == 0) {
|
||||
let abbrevs = abbreviations.merged.filter(function (abbr) abbr.inModes(modes));
|
||||
context.completions = [[abbr.lhs, abbr.rhs] for ([, abbr] in Iterator(abbrevs))];
|
||||
}
|
||||
completion.abbreviation = function abbreviation(context, modes) {
|
||||
let abbrevs = abbreviations.merged.filter(function (abbr) abbr.inModes(modes));
|
||||
context.completions = [[abbr.lhs, abbr.rhs] for ([, abbr] in Iterator(abbrevs))];
|
||||
};
|
||||
},
|
||||
|
||||
@@ -252,7 +249,7 @@ const Abbreviations = Module("abbreviations", {
|
||||
],
|
||||
completer: function (context, args) {
|
||||
if (args.length == 1)
|
||||
return completion.abbreviation(context, args, modes);
|
||||
return completion.abbreviation(context, modes);
|
||||
else if (args["-javascript"])
|
||||
return completion.javascript(context);
|
||||
},
|
||||
@@ -279,7 +276,7 @@ const Abbreviations = Module("abbreviations", {
|
||||
return dactyl.echoerr("E24: No such abbreviation");
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context, args) completion.abbreviation(context, args, modes),
|
||||
completer: function (context) completion.abbreviation(context, modes),
|
||||
literal: 0
|
||||
});
|
||||
|
||||
|
||||
@@ -1205,7 +1205,7 @@ const Buffer = Module("buffer", {
|
||||
|
||||
elem.value = file.path;
|
||||
}, {
|
||||
completer: completion.file,
|
||||
completer: function (context) completion.file(context),
|
||||
default: elem.value
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1252,7 +1252,7 @@ const Commands = Module("commands", {
|
||||
argCount: args["-nargs"],
|
||||
bang: args["-bang"],
|
||||
count: args["-count"],
|
||||
completer: completeFunc,
|
||||
completer: function (context) completeFunc(context),
|
||||
persist: !args["-nopersist"],
|
||||
replacementText: args.literalArg,
|
||||
sourcing: io.sourcing && update({}, io.sourcing)
|
||||
|
||||
@@ -851,7 +851,7 @@ const Completion = Module("completion", {
|
||||
},
|
||||
{
|
||||
argCount: "*",
|
||||
completer: function (context, args) {
|
||||
completer: function (context) {
|
||||
let PREFIX = "/ex/contexts";
|
||||
context.fork("ex", 0, completion, "ex");
|
||||
completion.contextList = [[k.substr(PREFIX.length), v.title[0]] for ([k, v] in iter(context.contexts)) if (k.substr(0, PREFIX.length) == PREFIX)];
|
||||
|
||||
@@ -406,7 +406,7 @@ const Mappings = Module("mappings", {
|
||||
const opts = {
|
||||
completer: function (context, args) {
|
||||
if (args.length == 1)
|
||||
return completion.userMapping(context, args, mapmodes);
|
||||
return completion.userMapping(context, mapmodes);
|
||||
if (args.length == 2) {
|
||||
if (args["-javascript"])
|
||||
return completion.javascript(context);
|
||||
@@ -515,7 +515,7 @@ const Mappings = Module("mappings", {
|
||||
},
|
||||
{
|
||||
argCount: "1",
|
||||
completer: function (context, args) completion.userMapping(context, args, mapmodes)
|
||||
completer: function (context) completion.userMapping(context, mapmodes)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -528,14 +528,11 @@ const Mappings = Module("mappings", {
|
||||
[mode.disp.toLowerCase()]);
|
||||
},
|
||||
completion: function () {
|
||||
completion.userMapping = function userMapping(context, args, modes) {
|
||||
completion.userMapping = function userMapping(context, modes) {
|
||||
// FIXME: have we decided on a 'standard' way to handle this clash? --djk
|
||||
modes = modes || [modules.modes.NORMAL];
|
||||
|
||||
if (args.completeArg == 0) {
|
||||
let maps = [[m.names[0], ""] for (m in mappings.getUserIterator(modes))];
|
||||
context.completions = maps;
|
||||
}
|
||||
let maps = [[m.names[0], ""] for (m in mappings.getUserIterator(modes))];
|
||||
context.completions = maps;
|
||||
};
|
||||
},
|
||||
javascript: function () {
|
||||
|
||||
@@ -408,7 +408,7 @@ const Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakR
|
||||
{
|
||||
names: ["-host", "-h"],
|
||||
description: "Only sanitize items referring to listed host or hosts",
|
||||
completer: function (context, args) {
|
||||
completer: function (context) {
|
||||
let hosts = context.filter.split(",");
|
||||
context.advance(context.filter.length - hosts.pop().length);
|
||||
context.filters.push(function (item)
|
||||
|
||||
Reference in New Issue
Block a user