mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 17:27:57 +01:00
normalize the completion module's method names
This commit is contained in:
@@ -260,7 +260,7 @@ vimperator.Buffer = function () //{{{
|
||||
}
|
||||
else
|
||||
{
|
||||
var items = vimperator.completion.getBufferCompletions("");
|
||||
var items = vimperator.completion.buffer("");
|
||||
vimperator.bufferwindow.show(items);
|
||||
vimperator.bufferwindow.selectItem(getBrowser().mTabContainer.selectedIndex);
|
||||
}
|
||||
@@ -268,7 +268,7 @@ vimperator.Buffer = function () //{{{
|
||||
else
|
||||
{
|
||||
// TODO: move this to vimperator.buffers.get()
|
||||
var items = vimperator.completion.getBufferCompletions("");
|
||||
var items = vimperator.completion.buffer("");
|
||||
var number, indicator, title, url;
|
||||
|
||||
var list = ":" + vimperator.util.escapeHTML(vimperator.commandline.getCommand()) + "<br/>" + "<table>";
|
||||
@@ -451,7 +451,7 @@ vimperator.Buffer = function () //{{{
|
||||
if (!vimperator.bufferwindow.visible())
|
||||
return false;
|
||||
|
||||
var items = vimperator.completion.getBufferCompletions("");
|
||||
var items = vimperator.completion.buffer("");
|
||||
vimperator.bufferwindow.show(items);
|
||||
vimperator.bufferwindow.selectItem(getBrowser().mTabContainer.selectedIndex);
|
||||
},
|
||||
@@ -784,7 +784,7 @@ vimperator.Buffer = function () //{{{
|
||||
regexps = vimperator.options["nextpattern"].split(",");
|
||||
break;
|
||||
case "previous":
|
||||
//TODO: accept prev\%[ious]
|
||||
// TODO: accept prev\%[ious]
|
||||
regexps = vimperator.options["previouspattern"].split(",");
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -653,7 +653,7 @@ vimperator.Commands = function () //{{{
|
||||
"it is selected. With <code class=\"argument\">[!]</code> the next buffer matching the argument " +
|
||||
"is selected, even if it cannot be identified uniquely.<br/>" +
|
||||
"Use <code class=\"mapping\">b</code> as a shortcut to open this prompt.",
|
||||
completer: function (filter) { return vimperator.completion.getBufferCompletions(filter); }
|
||||
completer: function (filter) { return vimperator.completion.buffer(filter); }
|
||||
}
|
||||
));
|
||||
commandManager.add(new vimperator.Command(["dia[log]"],
|
||||
@@ -988,7 +988,7 @@ vimperator.Commands = function () //{{{
|
||||
"<li><code class=\"command\">:help o</code> for mappings (no pre- or postfix)</li>" +
|
||||
"</ul>" +
|
||||
"You can however use partial stings in the tab completion, so <code class=\"command\">:help he<Tab></code> completes <code class=\"command\">:help :help</code>.",
|
||||
completer: function (filter) { return vimperator.completion.getHelpCompletions(filter); }
|
||||
completer: function (filter) { return vimperator.completion.help(filter); }
|
||||
}
|
||||
));
|
||||
commandManager.add(new vimperator.Command(["hist[ory]", "hs"],
|
||||
@@ -1496,7 +1496,7 @@ vimperator.Commands = function () //{{{
|
||||
"The items which are completed on <code class=\"mapping\"><Tab></code> are specified in the <code class=\"option\">'complete'</code> option.<br/>" +
|
||||
"Without argument, reloads the current page.<br/>" +
|
||||
"Without argument but with <code class=\"command\">!</code>, reloads the current page skipping the cache.",
|
||||
completer: function (filter) { return vimperator.completion.getUrlCompletions(filter); }
|
||||
completer: function (filter) { return vimperator.completion.url(filter); }
|
||||
}
|
||||
));
|
||||
commandManager.add(new vimperator.Command(["pa[geinfo]"],
|
||||
@@ -1856,7 +1856,7 @@ vimperator.Commands = function () //{{{
|
||||
"<code class=\"command\">:set option+={value}</code>, <code class=\"command\">:set option^={value}</code> and <code class=\"command\">:set option-={value}</code> " +
|
||||
"adds/multiplies/subtracts <code class=\"argument\">{value}</code> from a number option and appends/prepends/removes <code class=\"argument\">{value}</code> from a string option.<br/>" +
|
||||
"<code class=\"command\">:set all</code> shows the current value of all options and <code class=\"command\">:set all&</code> resets all options to their default values.<br/>",
|
||||
completer: function (filter) { return vimperator.completion.getOptionCompletions(filter); }
|
||||
completer: function (filter) { return vimperator.completion.option(filter); }
|
||||
}
|
||||
));
|
||||
// TODO: sclose instead?
|
||||
@@ -1910,7 +1910,7 @@ vimperator.Commands = function () //{{{
|
||||
shortHelp: "Open the sidebar window",
|
||||
help: "<code class=\"argument\">{name}</code> is any of the menu items listed under the standard Firefox View->Sidebar " +
|
||||
"menu. Add-ons, Preferences and Downloads are also available in the sidebar.",
|
||||
completer: function (filter) { return vimperator.completion.getSidebarCompletions(filter); }
|
||||
completer: function (filter) { return vimperator.completion.sidebar(filter); }
|
||||
}
|
||||
));
|
||||
commandManager.add(new vimperator.Command(["so[urce]"],
|
||||
@@ -1937,7 +1937,7 @@ vimperator.Commands = function () //{{{
|
||||
"The .vimperatorrc file in your home directory and any files in ~/.vimperator/plugin/ are always sourced at startup.<br/>" +
|
||||
"~ is supported as a shortcut for the <var>$HOME</var> directory.<br/>" +
|
||||
"If <code class=\"command\">!</code> is specified, errors are not printed.",
|
||||
completer: function (filter) { return vimperator.completion.getFileCompletions(filter); }
|
||||
completer: function (filter) { return vimperator.completion.file(filter); }
|
||||
}
|
||||
));
|
||||
commandManager.add(new vimperator.Command(["st[op]"],
|
||||
@@ -1955,7 +1955,7 @@ vimperator.Commands = function () //{{{
|
||||
help: "Works only for commands that support it, currently:" +
|
||||
"<ul><li>:tab help</li>" +
|
||||
"<li>:tab prefs[!]</li></ul>",
|
||||
completer: function (filter) { return vimperator.completion.getCommandCompletions(filter); }
|
||||
completer: function (filter) { return vimperator.completion.command(filter); }
|
||||
}
|
||||
));
|
||||
commandManager.add(new vimperator.Command(["tabl[ast]"],
|
||||
@@ -2023,7 +2023,7 @@ vimperator.Commands = function () //{{{
|
||||
shortHelp: "Open one or more URLs in a new tab",
|
||||
help: "Like <code class=\"command\">:open</code> but open URLs in a new tab.<br/>" +
|
||||
"If used with <code class=\"command\">!</code>, the 'tabopen' value of the <code class=\"option\">'activate'</code> option is negated.",
|
||||
completer: function (filter) { return vimperator.completion.getUrlCompletions(filter); }
|
||||
completer: function (filter) { return vimperator.completion.url(filter); }
|
||||
}
|
||||
));
|
||||
commandManager.add(new vimperator.Command(["tabp[revious]", "tp[revious]", "tabN[ext]", "tN[ext]"],
|
||||
|
||||
@@ -28,7 +28,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
||||
|
||||
vimperator.Completion = function () // {{{
|
||||
{
|
||||
// The completion substrings, used for showing the longest common match
|
||||
// the completion substrings, used for showing the longest common match
|
||||
var substrings = [];
|
||||
|
||||
// function uses smartcase
|
||||
@@ -74,7 +74,7 @@ vimperator.Completion = function () // {{{
|
||||
return filtered;
|
||||
} //}}}
|
||||
|
||||
/* this function is case sensitive and should be documented about input and output ;) */
|
||||
// this function is case sensitive and should be documented about input and output ;)
|
||||
function buildLongestStartingSubstring(list, filter) //{{{
|
||||
{
|
||||
var filtered = [];
|
||||
@@ -105,10 +105,9 @@ vimperator.Completion = function () // {{{
|
||||
} //}}}
|
||||
|
||||
return {
|
||||
/*
|
||||
* returns the longest common substring
|
||||
* used for the 'longest' setting for wildmode
|
||||
*/
|
||||
|
||||
// returns the longest common substring
|
||||
// used for the 'longest' setting for wildmode
|
||||
getLongestSubstring: function () //{{{
|
||||
{
|
||||
if (substrings.length == 0)
|
||||
@@ -158,14 +157,12 @@ vimperator.Completion = function () // {{{
|
||||
return buildLongestCommonSubstring(mapped, filter);
|
||||
}, //}}}
|
||||
|
||||
/*
|
||||
* filter a list of urls
|
||||
*
|
||||
* may consist of searchengines, filenames, bookmarks and history,
|
||||
* depending on the 'complete' option
|
||||
* if the 'complete' argument is passed like "h", it temporarily overrides the complete option
|
||||
*/
|
||||
getUrlCompletions: function (filter, complete) //{{{
|
||||
// filter a list of urls
|
||||
//
|
||||
// may consist of searchengines, filenames, bookmarks and history,
|
||||
// depending on the 'complete' option
|
||||
// if the 'complete' argument is passed like "h", it temporarily overrides the complete option
|
||||
url: function (filter, complete) //{{{
|
||||
{
|
||||
var completions = [];
|
||||
substrings = [];
|
||||
@@ -175,19 +172,19 @@ vimperator.Completion = function () // {{{
|
||||
for (var i = 0; i < cpt.length; i++)
|
||||
{
|
||||
if (cpt[i] == "s")
|
||||
completions = completions.concat(this.getSearchCompletions(filter));
|
||||
completions = completions.concat(this.search(filter));
|
||||
else if (cpt[i] == "b")
|
||||
completions = completions.concat(vimperator.bookmarks.get(filter));
|
||||
else if (cpt[i] == "h")
|
||||
completions = completions.concat(vimperator.history.get(filter));
|
||||
else if (cpt[i] == "f")
|
||||
completions = completions.concat(this.getFileCompletions(filter, true));
|
||||
completions = completions.concat(this.file(filter, true));
|
||||
}
|
||||
|
||||
return completions;
|
||||
}, //}}}
|
||||
|
||||
getSearchCompletions: function (filter) //{{{
|
||||
search: function (filter) //{{{
|
||||
{
|
||||
var engines = vimperator.bookmarks.getSearchEngines().concat(vimperator.bookmarks.getKeywords());
|
||||
|
||||
@@ -201,7 +198,7 @@ vimperator.Completion = function () // {{{
|
||||
}, //}}}
|
||||
|
||||
// TODO: support file:// and \ or / path separators on both platforms
|
||||
getFileCompletions: function (filter)
|
||||
file: function (filter)
|
||||
{
|
||||
// this is now also used as part of the url completion, so the
|
||||
// substrings shouldn't be cleared for that case
|
||||
@@ -233,7 +230,7 @@ vimperator.Completion = function () // {{{
|
||||
return buildLongestStartingSubstring(mapped, filter);
|
||||
},
|
||||
|
||||
getHelpCompletions: function (filter) //{{{
|
||||
help: function (filter) //{{{
|
||||
{
|
||||
var helpArray = [[["introduction"], "Introductory text"],
|
||||
[["initialization"], "Initialization and startup"],
|
||||
@@ -243,7 +240,7 @@ vimperator.Completion = function () // {{{
|
||||
substrings = [];
|
||||
for (var command in vimperator.commands)
|
||||
helpArray.push([command.longNames.map(function ($_) { return ":" + $_; }), command.shortHelp]);
|
||||
options = this.getOptionCompletions(filter, true);
|
||||
options = this.option(filter, true);
|
||||
helpArray = helpArray.concat(options.map(function ($_) {
|
||||
return [
|
||||
$_[0].map(function ($_) { return "'" + $_ + "'"; }),
|
||||
@@ -260,7 +257,7 @@ vimperator.Completion = function () // {{{
|
||||
return buildLongestCommonSubstring(helpArray, filter);
|
||||
}, //}}}
|
||||
|
||||
getCommandCompletions: function (filter) //{{{
|
||||
command: function (filter) //{{{
|
||||
{
|
||||
substrings = [];
|
||||
var completions = [];
|
||||
@@ -276,7 +273,7 @@ vimperator.Completion = function () // {{{
|
||||
return buildLongestStartingSubstring(completions, filter);
|
||||
}, //}}}
|
||||
|
||||
getOptionCompletions: function (filter, unfiltered) //{{{
|
||||
option: function (filter, unfiltered) //{{{
|
||||
{
|
||||
substrings = [];
|
||||
var optionCompletions = [];
|
||||
@@ -355,7 +352,7 @@ vimperator.Completion = function () // {{{
|
||||
return optionCompletions;
|
||||
}, //}}}
|
||||
|
||||
getBufferCompletions: function (filter) //{{{
|
||||
buffer: function (filter) //{{{
|
||||
{
|
||||
substrings = [];
|
||||
var items = [];
|
||||
@@ -391,7 +388,7 @@ vimperator.Completion = function () // {{{
|
||||
return buildLongestCommonSubstring(items, filter);
|
||||
}, //}}}
|
||||
|
||||
getSidebarCompletions: function (filter) //{{{
|
||||
sidebar: function (filter) //{{{
|
||||
{
|
||||
substrings = [];
|
||||
var menu = document.getElementById("viewSidebarMenu");
|
||||
@@ -517,11 +514,9 @@ vimperator.Completion = function () // {{{
|
||||
tags = tags.map(function (t) { return t.toLowerCase(); });
|
||||
}
|
||||
|
||||
/*
|
||||
* Longest Common Subsequence
|
||||
* This shouldn't use buildLongestCommonSubstring
|
||||
* for performance reasons, so as not to cycle through the urls twice
|
||||
*/
|
||||
// Longest Common Subsequence
|
||||
// This shouldn't use buildLongestCommonSubstring
|
||||
// for performance reasons, so as not to cycle through the urls twice
|
||||
outer:
|
||||
for (var i = 0; i < urls.length; i++)
|
||||
{
|
||||
@@ -605,6 +600,7 @@ vimperator.Completion = function () // {{{
|
||||
return false;
|
||||
},
|
||||
|
||||
// FIXME: rename
|
||||
exTabCompletion: function (str) //{{{
|
||||
{
|
||||
var [count, cmd, special, args] = vimperator.commands.parseCommand(str);
|
||||
@@ -616,7 +612,7 @@ vimperator.Completion = function () // {{{
|
||||
var matches = str.match(/^(:*\d*)\w*$/);
|
||||
if (matches)
|
||||
{
|
||||
completions = this.getCommandCompletions(cmd);
|
||||
completions = this.command(cmd);
|
||||
start = matches[1].length;
|
||||
}
|
||||
else // dynamically get completions as specified with the command's completer function
|
||||
|
||||
Reference in New Issue
Block a user