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

Fix buffer completion

This commit is contained in:
Kris Maglione
2008-11-26 08:15:01 +00:00
parent 78d700fd91
commit 3a85f642e2
4 changed files with 7 additions and 37 deletions

View File

@@ -955,12 +955,12 @@ function Buffer() //{{{
switch (relationship)
{
case "next":
regexps = options["nextpattern"].split(",");
regexps = options.get("nextpattern").values;
revString = "previous";
break;
case "previous":
// TODO: accept prev\%[ious]
regexps = options["previouspattern"].split(",");
regexps = options.get("previouspattern").values;
revString = "next";
break;
default:

View File

@@ -55,7 +55,7 @@ function CompletionContext(editor, name, offset)
self.parent = parent;
self.offset = parent.offset + (offset || 0);
self.keys = util.cloneObject(parent.keys);
["compare", "editor", "filterFunc", "keys", "quote", "title", "top"].forEach(function (key)
["compare", "editor", "filterFunc", "keys", "process", "quote", "title", "top"].forEach(function (key)
self[key] = parent[key]);
["contextList", "onUpdate", "selectionTypes", "tabPressed", "updateAsync", "value"].forEach(function (key) {
self.__defineGetter__(key, function () this.top[key]);
@@ -91,13 +91,14 @@ function CompletionContext(editor, name, offset)
}
return false;
}];
this.contexts = { name: this };
this.keys = { text: 0, description: 1, icon: "icon" };
this.offset = offset || 0;
this.onUpdate = function () true;
this.process = [];
this.tabPressed = false;
this.title = ["Completions"];
this.top = this;
this.contexts = { name: this };
this.__defineGetter__("incomplete", function () this.contextList.some(function (c) c.parent && c.incomplete));
this.selectionTypes = {};
this.reset();
@@ -106,7 +107,6 @@ function CompletionContext(editor, name, offset)
this.cache = {};
this.key = "";
this.itemCache = {};
this.process = [];
this._completions = []; // FIXME
this.getKey = function (item, key) (typeof self.keys[key] == "function") ? self.keys[key].call(this, item) : item.item[self.keys[key]];
}
@@ -1087,7 +1087,6 @@ function Completion() //{{{
context.keys = { text: "text", description: "url", icon: "icon" };
let process = context.process[0];
context.process = [function ({ text: text, item: item }) <>
<span style="display: inline-block; text-align: right; width: 3ex">{item.i}</span>
<span class="hl-Indicator" style="display: inline-block; width: 1.5em; text-align: center">{item.indicator}</span>
{ process.call(this, { item: item, text: text }) }
</>];
@@ -1116,7 +1115,7 @@ function Completion() //{{{
colorScheme: function colorScheme(context)
{
options["runtimepath"].split(",").forEach(function (path) {
options.get("runtimepath").values.forEach(function (path) {
context.fork(path, 0, null, function (context) {
context.filter = path + "/colors/" + context.filter;
completion.file(context, true);

View File

@@ -201,34 +201,6 @@ const template = {
});
},
// returns a single row for a bookmark or history item
bookmarkItem: function bookmarkItem(item)
{
var extra = [];
if (item.keyword)
extra.push(['keyword', item.keyword, "hl-Keyword"]);
if (item.tags && item.tags.length > 0)
extra.push(["tags", item.tags.join(","), "hl-Tag"]); // no space, otherwise it looks strange, since we just have spaces to seperate tags from keywords
return <ul class="hl-CompItem">
<li class="hl-CompIcon"><img src={item.icon || ""}/></li>
<li class="hl-CompResult">{util.clip(item.title || "", 50)}</li>
<li style="width: 100%">
<a href="#" class="hl-URL">{item.url}</a>&#160;
{
!(extra.length) ? "" :
<span class="extra-info">
({
template.map(extra, function (e)
<>{e[0]}: <span class={e[2]}>{e[1]}</span></>,
<>&#xa0;</>/* Non-breaking space */)
})
</span>
}
</li>
</ul>
},
jumps: function jumps(index, elems)
{
return this.generic(

View File

@@ -214,8 +214,7 @@ const util = { //{{{
}
for (let u = strNum[0].length - 3; u > 0; u -= 3) // make a 10000 a 10,000
strNum[0] = strNum[0].substring(0, u)
+ "," + strNum[0].substring(u, strNum[0].length);
strNum[0] = strNum[0].substr(0, u) + "," + strNum[0].substr(u);
if (unitIndex) // decimalPlaces only when > Bytes
strNum[0] += "." + strNum[1];