diff --git a/content/commands.js b/content/commands.js index cd26b200..4c121494 100644 --- a/content/commands.js +++ b/content/commands.js @@ -72,7 +72,7 @@ vimperator.Command = function (specs, description, action, extraInfo) //{{{ // return the primary command name (the long name of the first spec listed) this.name = this.longNames[0]; this.names = expandedSpecs.names; // return all command name aliases - this.description = extraInfo.description || ""; + this.description = description || ""; this.action = action; this.completer = extraInfo.completer || null; this.args = extraInfo.args || []; @@ -414,14 +414,6 @@ vimperator.Commands = function () //{{{ return def; } - function commandsIterator() - { - for (var i = 0; i < exCommands.length; i++) - yield exCommands[i]; - - throw StopIteration; - } - function getUserCommands(name) { var matches = []; @@ -467,7 +459,11 @@ vimperator.Commands = function () //{{{ __iterator__: function () { - return commandsIterator(); + var sorted = exCommands.sort(function (cmd1, cmd2) { return cmd1.name > cmd2.name; }); + for (var i = 0; i < sorted.length; i++) + yield sorted[i]; + + throw StopIteration; }, add: function (names, description, action, extra) diff --git a/content/completion.js b/content/completion.js index 5e74b524..356733da 100644 --- a/content/completion.js +++ b/content/completion.js @@ -302,6 +302,7 @@ vimperator.Completion = function () //{{{ { substrings = []; var completions = []; + if (!filter) { for (var command in vimperator.commands) diff --git a/content/mappings.js b/content/mappings.js index 64f4ea59..9671fc48 100644 --- a/content/mappings.js +++ b/content/mappings.js @@ -42,7 +42,7 @@ vimperator.Map = function (modes, cmds, description, action, extraInfo) //{{{ this.action = action; this.flags = extraInfo.flags || 0; - this.description = extraInfo.description || ""; + this.description = description || ""; this.rhs = extraInfo.rhs || null; this.noremap = extraInfo.noremap || false; }; diff --git a/content/ui.js b/content/ui.js index 3cbe0304..5d02db34 100644 --- a/content/ui.js +++ b/content/ui.js @@ -669,7 +669,6 @@ vimperator.CommandLine = function () //{{{ completionlist.selectItem(completionIndex); } - if (completionIndex == -1 && !longest) // wrapped around matches, reset command line { if (full && completions.length > 1) @@ -679,12 +678,14 @@ vimperator.CommandLine = function () //{{{ } else { + var compl = null; if (longest && completions.length > 1) - var compl = vimperator.completion.getLongestSubstring(); + compl = vimperator.completion.getLongestSubstring(); else if (full) - var compl = completions[completionIndex][0]; + compl = completions[completionIndex][0]; else if (completions.length == 1) - var compl = completions[0][0]; + compl = completions[0][0]; + if (compl) { setCommand(command.substring(0, completionStartIndex) + compl + completionPostfix);