mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 02:37:58 +01:00
complete ':set inv' with boolean options
This commit is contained in:
@@ -351,19 +351,17 @@ vimperator.completion = (function() // {{{
|
|||||||
{
|
{
|
||||||
g_substrings = [];
|
g_substrings = [];
|
||||||
var options_completions = [];
|
var options_completions = [];
|
||||||
var no_mode = false;
|
var prefix = filter.match(/^no|inv/) || "";
|
||||||
if (filter.indexOf("no") == 0) // boolean option
|
|
||||||
{
|
if (prefix)
|
||||||
no_mode = true;
|
filter = filter.replace(prefix, "");
|
||||||
filter = filter.substr(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unfiltered)
|
if (unfiltered)
|
||||||
{
|
{
|
||||||
var options = [];
|
var options = [];
|
||||||
for (var option in vimperator.options)
|
for (var option in vimperator.options)
|
||||||
{
|
{
|
||||||
if (no_mode && option.type != "boolean")
|
if (prefix && option.type != "boolean")
|
||||||
continue;
|
continue;
|
||||||
options.push([option.names, option.short_help])
|
options.push([option.names, option.short_help])
|
||||||
}
|
}
|
||||||
@@ -375,18 +373,16 @@ vimperator.completion = (function() // {{{
|
|||||||
var options = [];
|
var options = [];
|
||||||
for (var option in vimperator.options)
|
for (var option in vimperator.options)
|
||||||
{
|
{
|
||||||
if (no_mode && option.type != "boolean")
|
if (prefix && option.type != "boolean")
|
||||||
continue;
|
continue;
|
||||||
var prefix = no_mode ? 'no' : '';
|
|
||||||
options.push([prefix + option.name, option.short_help])
|
options.push([prefix + option.name, option.short_help])
|
||||||
}
|
}
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if filter ends with =, then complete current value
|
// check if filter ends with =, then complete current value
|
||||||
else if (filter.length > 0 && filter.lastIndexOf("=") == filter.length -1)
|
else if (filter.length > 0 && filter.lastIndexOf("=") == filter.length - 1)
|
||||||
{
|
{
|
||||||
filter = filter.substr(0, filter.length-1);
|
filter = filter.substr(0, filter.length - 1);
|
||||||
for (var option in vimperator.options)
|
for (var option in vimperator.options)
|
||||||
{
|
{
|
||||||
if (option.hasName(filter))
|
if (option.hasName(filter))
|
||||||
@@ -402,9 +398,8 @@ vimperator.completion = (function() // {{{
|
|||||||
var filter_length = filter.length;
|
var filter_length = filter.length;
|
||||||
for (var option in vimperator.options)
|
for (var option in vimperator.options)
|
||||||
{
|
{
|
||||||
if (no_mode && option.type != "boolean")
|
if (prefix && option.type != "boolean")
|
||||||
continue;
|
continue;
|
||||||
var prefix = no_mode ? 'no' : '';
|
|
||||||
for (var j = 0; j < option.names.length; j++)
|
for (var j = 0; j < option.names.length; j++)
|
||||||
{
|
{
|
||||||
if (option.names[j].indexOf(filter) != 0)
|
if (option.names[j].indexOf(filter) != 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user