mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-13 11:15:46 +01:00
Register support with a crude kill ring.
This commit is contained in:
@@ -6,8 +6,6 @@
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
"use strict";
|
||||
|
||||
try {
|
||||
|
||||
Components.utils.import("resource://dactyl/bootstrap.jsm");
|
||||
defineModule("completion", {
|
||||
exports: ["CompletionContext", "Completion", "completion"]
|
||||
@@ -221,7 +219,7 @@ var CompletionContext = Class("CompletionContext", {
|
||||
},
|
||||
get title() this.__title,
|
||||
|
||||
get activeContexts() this.contextList.filter(function (c) c.hasItems && c.items.length),
|
||||
get activeContexts() this.contextList.filter(function (c) c.items.length),
|
||||
|
||||
// Temporary
|
||||
/**
|
||||
@@ -356,6 +354,7 @@ var CompletionContext = Class("CompletionContext", {
|
||||
yield ["context", function () self];
|
||||
yield ["result", quote ? function () quote[0] + util.trapErrors(1, quote, this.text) + quote[2]
|
||||
: function () this.text];
|
||||
yield ["texts", function () Array.concat(this.text)];
|
||||
};
|
||||
|
||||
for (let i in iter(this.keys, result(this.quote))) {
|
||||
@@ -862,10 +861,9 @@ var CompletionContext = Class("CompletionContext", {
|
||||
|
||||
Filter: {
|
||||
text: function (item) {
|
||||
let text = item.texts || Array.concat(item.text);
|
||||
let text = item.texts;
|
||||
for (let [i, str] in Iterator(text)) {
|
||||
if (this.match(String(str))) {
|
||||
item.texts = text;
|
||||
item.text = String(text[i]);
|
||||
return true;
|
||||
}
|
||||
@@ -1063,11 +1061,13 @@ var Completion = Module("completion", {
|
||||
context.title[0] += " " + _("completion.additional");
|
||||
context.filter = context.parent.filter; // FIXME
|
||||
context.completions = context.parent.completions;
|
||||
|
||||
// For items whose URL doesn't exactly match the filter,
|
||||
// accept them if all tokens match either the URL or the title.
|
||||
// Filter out all directly matching strings.
|
||||
let match = context.filters[0];
|
||||
context.filters[0] = function (item) !match.call(this, item);
|
||||
|
||||
// and all that don't match the tokens.
|
||||
let tokens = context.filter.split(/\s+/);
|
||||
context.filters.push(function (item) tokens.every(
|
||||
@@ -1209,6 +1209,6 @@ var Completion = Module("completion", {
|
||||
|
||||
endModule();
|
||||
|
||||
} catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
|
||||
// catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
|
||||
|
||||
@@ -819,7 +819,7 @@ var RangeFind = Class("RangeFind", {
|
||||
let start = a.compareBoundaryPoints(a.START_TO_START, b) < 0 ? a : b;
|
||||
let end = a.compareBoundaryPoints(a.END_TO_END, b) > 0 ? a : b;
|
||||
let res = start.cloneRange();
|
||||
res.setEnd(end.startContainer, end.endOffset);
|
||||
res.setEnd(end.endContainer, end.endOffset);
|
||||
return res;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -93,12 +93,32 @@ var ArrayStore = Class("ArrayStore", StoreBase, {
|
||||
this.fireEvent("push", this._object.length);
|
||||
},
|
||||
|
||||
pop: function pop(value) {
|
||||
var res = this._object.pop();
|
||||
this.fireEvent("pop", this._object.length);
|
||||
pop: function pop(value, ord) {
|
||||
if (ord == null)
|
||||
var res = this._object.pop();
|
||||
else
|
||||
res = this._object.splice(ord, 1)[0];
|
||||
|
||||
this.fireEvent("pop", this._object.length, ord);
|
||||
return res;
|
||||
},
|
||||
|
||||
shift: function shift(value) {
|
||||
var res = this._object.shift();
|
||||
this.fireEvent("shift", this._object.length);
|
||||
return res;
|
||||
},
|
||||
|
||||
insert: function insert(value, ord) {
|
||||
if (ord == 0)
|
||||
this._object.unshift(value);
|
||||
else
|
||||
this._object = this._object.slice(0, ord)
|
||||
.concat([value])
|
||||
.concat(this._object.slice(ord));
|
||||
this.fireEvent("insert", this._object.length, ord);
|
||||
},
|
||||
|
||||
truncate: function truncate(length, fromEnd) {
|
||||
var res = this._object.length;
|
||||
if (this._object.length > length) {
|
||||
|
||||
Reference in New Issue
Block a user