1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 08:08:00 +01:00

Speed completion scrolling

This commit is contained in:
Kris Maglione
2008-11-25 01:29:51 +00:00
parent 8de6c9d8df
commit ac2378110d
3 changed files with 69 additions and 45 deletions

View File

@@ -108,6 +108,7 @@ CompletionContext.prototype = {
{
delete this.cache.filtered;
delete this.cache.filter;
this.cache.rows = [];
this.hasItems = items.length > 0;
this._completions = items;
let self = this;
@@ -126,10 +127,14 @@ CompletionContext.prototype = {
get generate() !this._generate ? null : function ()
{
this._completions = this._generate.call(this);
let updateAsync = this.updateAsync; // XXX
this.updateAsync = false;
this.completions = this._generate.call(this);
this.updateAsync = updateAsync;
this.cache.offset = this.offset;
this.cache.key = this.key;
return this._completions;
return this.completions;
},
set generate(arg)
{
@@ -217,15 +222,24 @@ CompletionContext.prototype = {
{
let self = this;
let items = this.items;
if (!items)
return [];
let reverse = start > end;
start = Math.max(0, start || 0);
end = Math.min(items.length, end ? end : items.length);
return util.map(util.range(start, end, reverse), function (i) items[i]);
},
getRows: function (start, end, doc)
{
let self = this;
let items = this.items;
let cache = this.cache.rows;
let reverse = start > end;
start = Math.max(0, start || 0);
end = Math.min(items.length, end ? end : items.length);
return util.map(util.range(start, end, reverse),
function (i) cache[i] = cache[i] || util.xmlToDom(self.createRow(items[i]), doc));
},
fork: function fork(name, offset, completer, self)
{
let context = new CompletionContext(this, name, offset);