aboutsummaryrefslogtreecommitdiffstats
path: root/fuzzyMode.js
diff options
context:
space:
mode:
authorNiklas Baumstark2012-01-25 00:41:47 +0100
committerNiklas Baumstark2012-04-10 23:57:20 +0200
commitb226ddf11348660dc8e9f39dcf7346944082ff67 (patch)
treeb1c91127a40989e6badfd575c8a75388b4dcb343 /fuzzyMode.js
parent99c19d210f4f7024585eb93d80967377c67fa44e (diff)
downloadvimium-b226ddf11348660dc8e9f39dcf7346944082ff67.tar.bz2
move query length threshold from UI to logic
This enables to set threshold to 0 for tabs (so that tabs are shown before typing).
Diffstat (limited to 'fuzzyMode.js')
-rw-r--r--fuzzyMode.js19
1 files changed, 5 insertions, 14 deletions
diff --git a/fuzzyMode.js b/fuzzyMode.js
index 1edb18f0..cfa8656f 100644
--- a/fuzzyMode.js
+++ b/fuzzyMode.js
@@ -18,14 +18,14 @@ var fuzzyMode = (function() {
else if (name === 'tabs')
return new completion.FuzzyTabCompleter();
else if (name === 'tabsSorted')
- return new completion.MergingCompleter([getCompleter('tabs')]);
+ return new completion.MergingCompleter([getCompleter('tabs')], 0);
else if (name === 'all')
return new completion.MergingCompleter([
getCompleter('smart'),
getCompleter('bookmarks'),
getCompleter('history'),
getCompleter('tabs'),
- ]);
+ ], 1);
}
function getCompleter(name) {
if (!(name in completers))
@@ -49,7 +49,6 @@ var fuzzyMode = (function() {
this.maxResults = maxResults;
this.refreshInterval = refreshInterval;
this.initDom();
- this.reset();
}
FuzzyBox.prototype = {
setCompleter: function(completer) {
@@ -141,17 +140,7 @@ var fuzzyMode = (function() {
return true;
},
- updateInput: function() {
- this.query = this.query.replace(/^\s*/, '');
- this.input.textContent = this.query;
- },
-
updateCompletions: function() {
- if (this.query.length == 0) {
- this.completionList.style.display = 'none';
- return;
- }
-
var self = this;
this.completer.filter(this.query, function(completions) {
self.completions = completions.slice(0, self.maxResults);
@@ -168,7 +157,9 @@ var fuzzyMode = (function() {
update: function(sync) {
sync = sync || false; // explicitely default to asynchronous updating
- this.updateInput();
+
+ this.query = this.query.replace(/^\s*/, '');
+ this.input.textContent = this.query;
if (sync) {
this.updateCompletions();