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

Alias c_<C-Tab> to c_<A-f>.

This commit is contained in:
Kris Maglione
2011-10-05 19:57:39 -04:00
parent f0028647c3
commit b43d9f914c
3 changed files with 31 additions and 22 deletions

View File

@@ -1609,14 +1609,14 @@ var CommandLine = Module("commandline", {
self.completions.onTab(keypressEvents[0]); self.completions.onTab(keypressEvents[0]);
}); });
bind(["<C-Tab>", "<compl-next-group>"], "Select the next matching completion group", bind(["<C-Tab>", "<A-f>", "<compl-next-group>"], "Select the next matching completion group",
function ({ keypressEvents, self }) { function ({ keypressEvents, self }) {
dactyl.assert(self.completions); dactyl.assert(self.completions);
self.completions.tabTimer.flush(); self.completions.tabTimer.flush();
self.completions.select(self.completions.CTXT_DOWN); self.completions.select(self.completions.CTXT_DOWN);
}); });
bind(["<C-S-Tab>", "<compl-prev-group>"], "Select the previous matching completion group", bind(["<C-S-Tab>", "<A-S-f>", "<compl-prev-group>"], "Select the previous matching completion group",
function ({ keypressEvents, self }) { function ({ keypressEvents, self }) {
dactyl.assert(self.completions); dactyl.assert(self.completions);
self.completions.tabTimer.flush(); self.completions.tabTimer.flush();
@@ -2128,7 +2128,7 @@ var ItemList = Class("ItemList", {
} }
}, },
getRow: function getRow(idx) this.context.getRow(idx), getRow: function getRow(idx) this.context.getRow(idx, this.doc),
getOffset: function getOffset(idx) this.offsets.start + (idx || 0), getOffset: function getOffset(idx) this.offsets.start + (idx || 0),

View File

@@ -363,7 +363,7 @@ var Editor = Module("editor", {
range.setStart(range.startContainer, range.endOffset - abbrev.lhs.length); range.setStart(range.startContainer, range.endOffset - abbrev.lhs.length);
this.mungeRange(range, function () abbrev.expand(this.element), true); this.mungeRange(range, function () abbrev.expand(this.element), true);
} }
}, }
}, { }, {
TextsIterator: Class("TextsIterator", { TextsIterator: Class("TextsIterator", {
init: function init(range, context, after) { init: function init(range, context, after) {

View File

@@ -349,11 +349,15 @@ var CompletionContext = Class("CompletionContext", {
* The prototype object for items returned by {@link items}. * The prototype object for items returned by {@link items}.
*/ */
get itemPrototype() { get itemPrototype() {
let self = this;
let res = { highlight: "" }; let res = { highlight: "" };
function result(quote) { function result(quote) {
yield ["context", function () self];
yield ["result", quote ? function () quote[0] + util.trapErrors(1, quote, this.text) + quote[2] yield ["result", quote ? function () quote[0] + util.trapErrors(1, quote, this.text) + quote[2]
: function () this.text]; : function () this.text];
}; };
for (let i in iter(this.keys, result(this.quote))) { for (let i in iter(this.keys, result(this.quote))) {
let [k, v] = i; let [k, v] = i;
if (typeof v == "string" && /^[.[]/.test(v)) if (typeof v == "string" && /^[.[]/.test(v))
@@ -361,7 +365,7 @@ var CompletionContext = Class("CompletionContext", {
// reference any variables. Don't bother with eval context. // reference any variables. Don't bother with eval context.
v = Function("i", "return i" + v); v = Function("i", "return i" + v);
if (typeof v == "function") if (typeof v == "function")
res.__defineGetter__(k, function () Class.replaceProperty(this, k, v.call(this, this.item))); res.__defineGetter__(k, function () Class.replaceProperty(this, k, v.call(this, this.item, self)));
else else
res.__defineGetter__(k, function () Class.replaceProperty(this, k, this.item[v])); res.__defineGetter__(k, function () Class.replaceProperty(this, k, this.item[v]));
res.__defineSetter__(k, function (val) Class.replaceProperty(this, k, val)); res.__defineSetter__(k, function (val) Class.replaceProperty(this, k, val));
@@ -636,7 +640,25 @@ var CompletionContext = Class("CompletionContext", {
return iter.map(util.range(start, end, step), function (i) items[i]); return iter.map(util.range(start, end, step), function (i) items[i]);
}, },
getRow: function getRow(idx) this.cache.rows && this.cache.rows[idx], getRow: function getRow(idx, doc) {
let cache = this.cache.rows;
if (cache) {
if (!(idx in this.cache.rows))
try {
cache[idx] = util.xmlToDom(this.createRow(this.items[idx]),
doc || this.doc);
}
catch (e) {
util.reportError(e);
cache[idx] = util.xmlToDom(
<div highlight="CompItem" style="white-space: nowrap">
<li highlight="CompResult">{this.text}&#xa0;</li>
<li highlight="CompDesc ErrorMsg">{e}&#xa0;</li>
</div>, doc || this.doc);
}
return cache[idx];
}
},
getRows: function getRows(start, end, doc) { getRows: function getRows(start, end, doc) {
let self = this; let self = this;
@@ -647,22 +669,9 @@ var CompletionContext = Class("CompletionContext", {
start = Math.max(0, start || 0); start = Math.max(0, start || 0);
end = Math.min(items.length, end != null ? end : items.length); end = Math.min(items.length, end != null ? end : items.length);
for (let i in util.range(start, end, step)) { this.doc = doc;
if (!cache[i]) for (let i in util.range(start, end, step))
try { yield [i, this.getRow(i)];
cache[i] = util.xmlToDom(self.createRow(items[i]), doc);
}
catch (e) {
util.reportError(e);
cache[i] = util.xmlToDom(
<div highlight="CompItem" style="white-space: nowrap">
<li highlight="CompResult">{items[i].text}&#xa0;</li>
<li highlight="CompDesc ErrorMsg">{e}&#xa0;</li>
</div>, doc);
}
yield [i, cache[i]];
}
}, },
/** /**