mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 10:47:59 +01:00
Also add completion.option, just for the hell of it.
This commit is contained in:
@@ -1338,7 +1338,14 @@ function Completion() //{{{
|
|||||||
|
|
||||||
menuItem: function menuItem(filter) commands.get("emenu").completer(filter), // XXX
|
menuItem: function menuItem(filter) commands.get("emenu").completer(filter), // XXX
|
||||||
|
|
||||||
option: function option(filter) commands.get("set").completer(filter), // XXX
|
option: function option(context, scope)
|
||||||
|
{
|
||||||
|
context.title = ["Option"];
|
||||||
|
context.keys = { text: "names", description: "description" };
|
||||||
|
context.completions = options;
|
||||||
|
if (scope)
|
||||||
|
context.filters.push(function ({item: opt}) opt.scope & scope);
|
||||||
|
},
|
||||||
|
|
||||||
optionValue: function (context, name, op, curValue)
|
optionValue: function (context, name, op, curValue)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -685,30 +685,21 @@ function Options() //{{{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let prefix = (filter.match(/^(no|inv)/) || [""])[0];
|
let opt = options.parseOpt(filter, modifiers);
|
||||||
|
let prefix = opt.prefix;
|
||||||
if (prefix)
|
if (prefix)
|
||||||
context.filter = filter = filter.substr(prefix.length);
|
context.advance(prefix.length);
|
||||||
|
|
||||||
let scope = modifiers && modifiers.scope || options.OPTION_SCOPE_BOTH;
|
if (context.filter.indexOf("=") == -1)
|
||||||
|
|
||||||
let opts = (opt for (opt in options)
|
|
||||||
if ((opt.scope & scope) &&
|
|
||||||
(!prefix || opt.type == "boolean" ||
|
|
||||||
prefix == "inv" && opt.value instanceof Array)));
|
|
||||||
|
|
||||||
if (filter.indexOf("=") == -1)
|
|
||||||
{
|
{
|
||||||
context.title = ["Option"];
|
if (prefix)
|
||||||
context.quote = [prefix, util.identity, ""];
|
context.filters.push(function ({item: opt}) opt.type == "boolean" || prefix == "inv" && opt.values instanceof Array);
|
||||||
context.keys = { text: "names", description: "description" };
|
return completion.option(context, opt.scope);
|
||||||
context.completions = opts;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else if (prefix == "no")
|
else if (prefix == "no")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let [name, value] = filter.split("=", 2);
|
let [name, value] = context.filter.split("=", 2);
|
||||||
let opt = options.parseOpt(filter, modifiers);
|
|
||||||
let option = opt.option;
|
let option = opt.option;
|
||||||
context.advance(name.length + 1);
|
context.advance(name.length + 1);
|
||||||
|
|
||||||
@@ -915,7 +906,7 @@ function Options() //{{{
|
|||||||
let matches, prefix, postfix, valueGiven;
|
let matches, prefix, postfix, valueGiven;
|
||||||
|
|
||||||
[matches, prefix, ret.name, postfix, valueGiven, ret.operator, ret.value] =
|
[matches, prefix, ret.name, postfix, valueGiven, ret.operator, ret.value] =
|
||||||
args.match(/^\s*(no|inv)?([a-z_]+)([?&!])?\s*(([-+^]?)=(.*))?\s*$/) || [];
|
args.match(/^\s*(no|inv)?([a-z_]*)([?&!])?\s*(([-+^]?)=(.*))?\s*$/) || [];
|
||||||
|
|
||||||
ret.args = args;
|
ret.args = args;
|
||||||
ret.onlyNonDefault = false; // used for :set to print non-default options
|
ret.onlyNonDefault = false; // used for :set to print non-default options
|
||||||
|
|||||||
Reference in New Issue
Block a user