mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 18:07:58 +01:00
remove COMMANDS, USAGE, SHORTHELP and HELP global constants
This commit is contained in:
@@ -26,11 +26,6 @@ the provisions above, a recipient may use your version of this file under
|
|||||||
the terms of any one of the MPL, the GPL or the LGPL.
|
the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
}}} ***** END LICENSE BLOCK *****/
|
}}} ***** END LICENSE BLOCK *****/
|
||||||
|
|
||||||
const COMMANDS = 0;
|
|
||||||
const USAGE = 1;
|
|
||||||
const SHORTHELP = 2;
|
|
||||||
const HELP = 3;
|
|
||||||
|
|
||||||
/* [command, action, cancel_hint_mode, always_active] */
|
/* [command, action, cancel_hint_mode, always_active] */
|
||||||
var g_hint_mappings = [ /*{{{*/
|
var g_hint_mappings = [ /*{{{*/
|
||||||
/* hint action keys */
|
/* hint action keys */
|
||||||
|
|||||||
@@ -74,23 +74,23 @@ function build_longest_starting_substring(list, filter)/*{{{*/
|
|||||||
//var filter_length = filter.length;
|
//var filter_length = filter.length;
|
||||||
for (var i = 0; i < list.length; i++)
|
for (var i = 0; i < list.length; i++)
|
||||||
{
|
{
|
||||||
for (var j = 0; j < list[i][COMMANDS].length; j++)
|
for (var j = 0; j < list[i][0].length; j++)
|
||||||
{
|
{
|
||||||
if (list[i][0][j].indexOf(filter) != 0)
|
if (list[i][0][j].indexOf(filter) != 0)
|
||||||
continue;
|
continue;
|
||||||
if (g_substrings.length == 0)
|
if (g_substrings.length == 0)
|
||||||
{
|
{
|
||||||
var length = list[i][COMMANDS][j].length;
|
var length = list[i][0][j].length;
|
||||||
for (var k = filter.length; k <= length; k++)
|
for (var k = filter.length; k <= length; k++)
|
||||||
g_substrings.push(list[i][COMMANDS][j].substring(0, k));
|
g_substrings.push(list[i][0][j].substring(0, k));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_substrings = g_substrings.filter(function($_) {
|
g_substrings = g_substrings.filter(function($_) {
|
||||||
return list[i][COMMANDS][j].indexOf($_) == 0;
|
return list[i][0][j].indexOf($_) == 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
filtered.push([list[i][COMMANDS][j], list[i][SHORTHELP]]);
|
filtered.push([list[i][0][j], list[i][1]]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -268,7 +268,7 @@ function get_help_completions(filter)/*{{{*/
|
|||||||
options = get_options_completions(filter, true);
|
options = get_options_completions(filter, true);
|
||||||
help_array = help_array.concat(options.map(function($_) {
|
help_array = help_array.concat(options.map(function($_) {
|
||||||
return [
|
return [
|
||||||
$_[COMMANDS].map(function($_) { return "'" + $_ + "'"; }),
|
$_[0].map(function($_) { return "'" + $_ + "'"; }),
|
||||||
$_[1]
|
$_[1]
|
||||||
];
|
];
|
||||||
}));
|
}));
|
||||||
@@ -276,7 +276,7 @@ function get_help_completions(filter)/*{{{*/
|
|||||||
help_array.push([map.names, map.short_help])
|
help_array.push([map.names, map.short_help])
|
||||||
|
|
||||||
if (!filter) return help_array.map(function($_) {
|
if (!filter) return help_array.map(function($_) {
|
||||||
return [$_[COMMANDS][0], $_[1]]; // unfiltered, use the first command
|
return [$_[0][0], $_[1]]; // unfiltered, use the first command
|
||||||
});
|
});
|
||||||
|
|
||||||
return build_longest_common_substring(help_array, filter);
|
return build_longest_common_substring(help_array, filter);
|
||||||
@@ -295,7 +295,7 @@ function get_command_completions(filter)/*{{{*/
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (var command in vimperator.commands)
|
for (var command in vimperator.commands)
|
||||||
completions.push([command.long_names, null, command.short_help]); // # FIXME: just return it in the format expected by blss() for now -- djk
|
completions.push([command.long_names, command.short_help]); // # FIXME: just return it in the format expected by blss() for now -- djk
|
||||||
return build_longest_starting_substring(completions, filter);
|
return build_longest_starting_substring(completions, filter);
|
||||||
}/*}}}*/
|
}/*}}}*/
|
||||||
|
|
||||||
@@ -438,9 +438,9 @@ function exTabCompletion(str)
|
|||||||
if (command && command.completer)
|
if (command && command.completer)
|
||||||
{
|
{
|
||||||
completions = command.completer.call(this, args);
|
completions = command.completer.call(this, args);
|
||||||
// if (command[COMMANDS][0] == "open" ||
|
// if (command[0][0] == "open" ||
|
||||||
// command[COMMANDS][0] == "tabopen" ||
|
// command[0][0] == "tabopen" ||
|
||||||
// command[COMMANDS][0] == "winopen")
|
// command[0][0] == "winopen")
|
||||||
// start = str.search(/^:*\d*\w+(\s+|.*\|)/); // up to the last | or the first space
|
// start = str.search(/^:*\d*\w+(\s+|.*\|)/); // up to the last | or the first space
|
||||||
// else
|
// else
|
||||||
matches = str.match(/^:*\d*\w+\s+/); // up to the first spaces only
|
matches = str.match(/^:*\d*\w+\s+/); // up to the first spaces only
|
||||||
|
|||||||
Reference in New Issue
Block a user