mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 18:42:27 +01:00
Speed up JS completion more.
This commit is contained in:
@@ -30,7 +30,6 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
const EVAL_TMP = "__liberator_eval_tmp";
|
const EVAL_TMP = "__liberator_eval_tmp";
|
||||||
function __eval(__liberator_eval_arg, __liberator_eval_tmp)
|
function __eval(__liberator_eval_arg, __liberator_eval_tmp)
|
||||||
{
|
{
|
||||||
liberator.dump({__liberator_eval_tmp: __liberator_eval_tmp, __liberator_eval_arg: __liberator_eval_arg})
|
|
||||||
return window.eval(__liberator_eval_arg);
|
return window.eval(__liberator_eval_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,6 +136,8 @@ function Completion() //{{{
|
|||||||
if (!(objects instanceof Array))
|
if (!(objects instanceof Array))
|
||||||
objects = [objects];
|
objects = [objects];
|
||||||
|
|
||||||
|
completion.filterMap = [null, function (v) template.highlight(v, true)];
|
||||||
|
|
||||||
if (cacheFilter.js === cacheKey)
|
if (cacheFilter.js === cacheKey)
|
||||||
return cacheResults.js;
|
return cacheResults.js;
|
||||||
cacheFilter.js = cacheKey;
|
cacheFilter.js = cacheKey;
|
||||||
@@ -152,7 +153,7 @@ function Completion() //{{{
|
|||||||
obj = obj.wrappedJSObject;
|
obj = obj.wrappedJSObject;
|
||||||
|
|
||||||
for (let [k, v] in this.iter(obj))
|
for (let [k, v] in this.iter(obj))
|
||||||
compl.push([k, template.highlight(v, true)]);
|
compl.push([k, v]);
|
||||||
}
|
}
|
||||||
return cacheResults.js = compl;
|
return cacheResults.js = compl;
|
||||||
}
|
}
|
||||||
@@ -851,6 +852,7 @@ function Completion() //{{{
|
|||||||
// provides completions for ex commands, including their arguments
|
// provides completions for ex commands, including their arguments
|
||||||
ex: function ex(str)
|
ex: function ex(str)
|
||||||
{
|
{
|
||||||
|
this.filterMap = null;
|
||||||
this.filterString = "";
|
this.filterString = "";
|
||||||
this.parenMatch = null;
|
this.parenMatch = null;
|
||||||
substrings = [];
|
substrings = [];
|
||||||
|
|||||||
@@ -1281,6 +1281,13 @@ function ItemList(id) //{{{
|
|||||||
// TODO: temporary, to be changed/removed
|
// TODO: temporary, to be changed/removed
|
||||||
function createRow([b, c, a], dom)
|
function createRow([b, c, a], dom)
|
||||||
{
|
{
|
||||||
|
/* Kludge until we have completion contexts. */
|
||||||
|
let map = completion.filterMap;
|
||||||
|
if (map)
|
||||||
|
{
|
||||||
|
b = map[0] ? map[0](b) : b;
|
||||||
|
c = map[1] ? map[1](c) : c;
|
||||||
|
}
|
||||||
/* Obviously, ItemList shouldn't know or care about this. */
|
/* Obviously, ItemList shouldn't know or care about this. */
|
||||||
let filter = completion.filterString;
|
let filter = completion.filterString;
|
||||||
if (filter)
|
if (filter)
|
||||||
|
|||||||
Reference in New Issue
Block a user