summaryrefslogtreecommitdiff
path: root/vimperator
diff options
context:
space:
mode:
authorDoug Kearns <dougkearns@gmail.com>2009-06-18 20:46:09 +1000
committerDoug Kearns <dougkearns@gmail.com>2009-06-18 22:02:21 +1000
commitec8d7686fca3f70ee85cfe99cd55dab5a1ba024f (patch)
tree4abdc2e00220e1f54b8ec81e2be46d6e89056895 /vimperator
parent561ed5fc3e53ec079bb13daee0d4b3ca9f0f1353 (diff)
downloadpentadactyl-ec8d7686fca3f70ee85cfe99cd55dab5a1ba024f.tar.gz
Move the standard type completers to appropriate modules.
Diffstat (limited to 'vimperator')
-rw-r--r--vimperator/content/config.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/vimperator/content/config.js b/vimperator/content/config.js
index 65ea883f..e319fd43 100644
--- a/vimperator/content/config.js
+++ b/vimperator/content/config.js
@@ -505,6 +505,50 @@ const config = { //{{{
"Set the separator regexp used to separate multiple URL args",
"string", ",\\s");
+ /////////////////////////////////////////////////////////////////////////////}}}
+ ////////////////////// COMPLETIONS /////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////////////{{{
+
+ completion.location = function location(context) {
+ if (!services.get("autoCompleteSearch"))
+ return;
+
+ context.anchored = false;
+ context.title = ["Smart Completions"];
+ context.keys.icon = 2;
+ context.incomplete = true;
+ context.hasItems = context.completions.length > 0; // XXX
+ context.filterFunc = null;
+ context.cancel = function () services.get("autoCompleteSearch").stopSearch();
+ context.compare = CompletionContext.Sort.unsorted;
+ let timer = new Timer(50, 100, function (result) {
+ context.incomplete = result.searchResult >= result.RESULT_NOMATCH_ONGOING;
+ context.completions = [
+ [result.getValueAt(i), result.getCommentAt(i), result.getImageAt(i)]
+ for (i in util.range(0, result.matchCount))
+ ];
+ });
+ services.get("autoCompleteSearch").stopSearch();
+ services.get("autoCompleteSearch").startSearch(context.filter, "", context.result, {
+ onSearchResult: function onSearchResult(search, result) {
+ context.result = result;
+ timer.tell(result);
+ if (result.searchResult <= result.RESULT_SUCCESS)
+ timer.flush();
+ }
+ });
+ };
+
+ completion.sidebar = function sidebar(context) {
+ let menu = document.getElementById("viewSidebarMenu");
+ context.title = ["Sidebar Panel"];
+ context.completions = Array.map(menu.childNodes, function (n) [n.label, ""]);
+ };
+
+ completion.addUrlCompleter("l",
+ "Firefox location bar entries (bookmarks and history sorted in an intelligent way)",
+ completion.location);
+
//}}}
}
}; //}}}