mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 10:08:00 +01:00
Major documentation updates and formatting fixes, and many, many other changes thanks to an MQ glitch, including:
* Significant completion speed improvements * Significantly improve startup speed, in large part by lazily instantiating Options and Commands, lazily installing highlight stylesheets, etc. * Update logos and icons, fix atrocious about page * Fix Teledactyl * JavaScript completion now avoids accessing property values * Add Option#persist to define which options are saved with :mkp * Add new Dactyl component which holds add-on-specific configuration information and removes need for separate components for each dactyl host * Several fixes for latest nightlies * Significant code cleanup and many bug fixes --HG-- rename : muttator/AUTHORS => teledactyl/AUTHORS rename : muttator/Donors => teledactyl/Donors rename : muttator/Makefile => teledactyl/Makefile rename : muttator/NEWS => teledactyl/NEWS rename : muttator/TODO => teledactyl/TODO rename : muttator/chrome.manifest => teledactyl/chrome.manifest rename : muttator/components/commandline-handler.js => teledactyl/components/commandline-handler.js rename : muttator/components/protocols.js => teledactyl/components/protocols.js rename : muttator/content/addressbook.js => teledactyl/content/addressbook.js rename : muttator/content/compose/compose.js => teledactyl/content/compose/compose.js rename : muttator/content/compose/compose.xul => teledactyl/content/compose/compose.xul rename : muttator/content/compose/dactyl.dtd => teledactyl/content/compose/dactyl.dtd rename : muttator/content/compose/dactyl.xul => teledactyl/content/compose/dactyl.xul rename : muttator/content/config.js => teledactyl/content/config.js rename : muttator/content/dactyl.dtd => teledactyl/content/dactyl.dtd rename : muttator/content/logo.png => teledactyl/content/logo.png rename : muttator/content/mail.js => teledactyl/content/mail.js rename : muttator/content/muttator.xul => teledactyl/content/pentadactyl.xul rename : muttator/contrib/vim/Makefile => teledactyl/contrib/vim/Makefile rename : muttator/contrib/vim/ftdetect/muttator.vim => teledactyl/contrib/vim/ftdetect/muttator.vim rename : muttator/contrib/vim/mkvimball.txt => teledactyl/contrib/vim/mkvimball.txt rename : muttator/contrib/vim/syntax/muttator.vim => teledactyl/contrib/vim/syntax/muttator.vim rename : muttator/install.rdf => teledactyl/install.rdf rename : muttator/locale/en-US/Makefile => teledactyl/locale/en-US/Makefile rename : muttator/locale/en-US/all.xml => teledactyl/locale/en-US/all.xml rename : muttator/locale/en-US/autocommands.xml => teledactyl/locale/en-US/autocommands.xml rename : muttator/locale/en-US/gui.xml => teledactyl/locale/en-US/gui.xml rename : muttator/locale/en-US/intro.xml => teledactyl/locale/en-US/intro.xml rename : muttator/skin/icon.png => teledactyl/skin/icon.png
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2008-2009 by Kris Maglione <maglione.k at Gmail>
|
||||
// Copyright (c) 2008-2010 by Kris Maglione <maglione.k at Gmail>
|
||||
//
|
||||
// This work is licensed for reuse under an MIT license. Details are
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
@@ -41,11 +41,13 @@ const JavaScript = Module("javascript", {
|
||||
let seen = {};
|
||||
for (let key in properties(obj, !toplevel)) {
|
||||
set.add(seen, key);
|
||||
yield [key, this.getKey(obj, key)];
|
||||
yield key;
|
||||
}
|
||||
// Properties aren't visible in an XPCNativeWrapper until
|
||||
// they're accessed.
|
||||
for (let key in properties(this.getKey(obj, "wrappedJSObject"), !toplevel))
|
||||
if (!set.has(seen, key))
|
||||
yield [key, this.getKey(obj, key)];
|
||||
if (key in obj && !set.has(seen, key))
|
||||
yield key;
|
||||
},
|
||||
|
||||
objectKeys: function objectKeys(obj, toplevel) {
|
||||
@@ -110,15 +112,14 @@ const JavaScript = Module("javascript", {
|
||||
},
|
||||
|
||||
_pop: function pop(arg) {
|
||||
if (this._top.char != arg) {
|
||||
this.context.highlight(this._top.offset, this._i - this._top.offset, "SPELLCHECK");
|
||||
this.context.highlight(this._top.offset, 1, "FIND");
|
||||
throw new Error("Invalid JS");
|
||||
}
|
||||
|
||||
if (this._i == this.context.caret - 1)
|
||||
this.context.highlight(this._top.offset, 1, "FIND");
|
||||
|
||||
if (this._top.char != arg) {
|
||||
this.context.highlight(this._top.offset, this._i - this._top.offset, "SPELLCHECK");
|
||||
throw Error("Invalid JS");
|
||||
}
|
||||
|
||||
// The closing character of this stack frame will have pushed a new
|
||||
// statement, leaving us with an empty statement. This doesn't matter,
|
||||
// now, as we simply throw away the frame when we pop it, but it may later.
|
||||
@@ -139,11 +140,13 @@ const JavaScript = Module("javascript", {
|
||||
|
||||
// Reuse the old stack.
|
||||
if (this._str && filter.substr(0, this._str.length) == this._str) {
|
||||
this.context.highlight(0, 0, "FIND");
|
||||
this._i = this._str.length;
|
||||
if (this.popStatement)
|
||||
this._top.statements.pop();
|
||||
}
|
||||
else {
|
||||
this.context.highlight();
|
||||
this._stack = [];
|
||||
this._functions = [];
|
||||
this._push("#root");
|
||||
@@ -239,7 +242,7 @@ const JavaScript = Module("javascript", {
|
||||
_getObj: function (frame, stop) {
|
||||
let statement = this._get(frame, 0, "statements") || 0; // Current statement.
|
||||
let prev = statement;
|
||||
let obj;
|
||||
let obj = null;
|
||||
let cacheKey;
|
||||
for (let [, dot] in Iterator(this._get(frame).dots.concat(stop))) {
|
||||
if (dot < statement)
|
||||
@@ -285,19 +288,19 @@ const JavaScript = Module("javascript", {
|
||||
return [dot + 1 + space.length, obj, key];
|
||||
},
|
||||
|
||||
_fill: function (context, obj, name, compl, anchored, key, last, offset) {
|
||||
context.title = [name];
|
||||
context.anchored = anchored;
|
||||
context.filter = key;
|
||||
_fill: function (context, args) {
|
||||
context.title = [args.name];
|
||||
context.anchored = args.anchored;
|
||||
context.filter = args.filter;
|
||||
context.itemCache = context.parent.itemCache;
|
||||
context.key = name + last;
|
||||
context.key = args.name + args.last;
|
||||
|
||||
if (last != null)
|
||||
context.quote = [last, function (text) util.escapeString(text.substr(offset), ""), last];
|
||||
if (args.last != null)
|
||||
context.quote = [args.last, function (text) util.escapeString(text.substr(args.offset), ""), args.last];
|
||||
else // We're not looking for a quoted string, so filter out anything that's not a valid identifier
|
||||
context.filters.push(function (item) /^[a-zA-Z_$][\w$]*$/.test(item.text));
|
||||
|
||||
compl.call(self, context, obj);
|
||||
args.completer.call(self, context, args.obj);
|
||||
},
|
||||
|
||||
_complete: function (objects, key, compl, string, last) {
|
||||
@@ -309,7 +312,10 @@ const JavaScript = Module("javascript", {
|
||||
let orig = compl;
|
||||
if (!compl) {
|
||||
compl = function (context, obj, recurse) {
|
||||
context.process = [null, function highlight(item, v) template.highlight(typeof v == "xml" ? new String(v.toXMLString()) : v, true)];
|
||||
|
||||
context.process[1] = function highlight(item, v)
|
||||
template.highlight(typeof v == "xml" ? new String(v.toXMLString()) : v, true);
|
||||
|
||||
// Sort in a logical fashion for object keys:
|
||||
// Numbers are sorted as numbers, rather than strings, and appear first.
|
||||
// Constants are unsorted, and appear before other non-null strings.
|
||||
@@ -321,14 +327,15 @@ const JavaScript = Module("javascript", {
|
||||
return a.key - b.key;
|
||||
return isnan(b.key) - isnan(a.key) || compare(a, b);
|
||||
};
|
||||
context.keys = { text: 0, description: 1,
|
||||
context.keys = {
|
||||
text: util.identity,
|
||||
description: function (item) self.getKey(obj, item),
|
||||
key: function (item) {
|
||||
let key = item[0];
|
||||
if (!isNaN(key))
|
||||
return parseInt(key);
|
||||
else if (/^[A-Z_][A-Z0-9_]*$/.test(key))
|
||||
if (/^[A-Z_][A-Z0-9_]*$/.test(key))
|
||||
return ""
|
||||
return key;
|
||||
return item;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -339,37 +346,51 @@ const JavaScript = Module("javascript", {
|
||||
context.generate = function () self.objectKeys(obj, !recurse);
|
||||
};
|
||||
}
|
||||
|
||||
let args = {
|
||||
completer: compl,
|
||||
anchored: true,
|
||||
filter: key + (string || ""),
|
||||
last: last,
|
||||
offset: key.length
|
||||
};
|
||||
|
||||
// TODO: Make this a generic completion helper function.
|
||||
let filter = key + (string || "");
|
||||
for (let [, obj] in Iterator(objects)) {
|
||||
for (let [, obj] in Iterator(objects))
|
||||
this.context.fork(obj[1], this._top.offset, this, this._fill,
|
||||
obj[0], obj[1], compl,
|
||||
true, filter, last, key.length);
|
||||
}
|
||||
update(args, {
|
||||
obj: obj[0],
|
||||
name: obj[1],
|
||||
}));
|
||||
|
||||
if (orig)
|
||||
return;
|
||||
|
||||
for (let [, obj] in Iterator(objects)) {
|
||||
let name = obj[1] + " (prototypes)";
|
||||
this.context.fork(name, this._top.offset, this, this._fill,
|
||||
obj[0], name, function (a, b) compl(a, b, true),
|
||||
true, filter, last, key.length);
|
||||
}
|
||||
for (let [, obj] in Iterator(objects))
|
||||
this.context.fork(obj[1] + "/prototypes", this._top.offset, this, this._fill,
|
||||
update(args, {
|
||||
obj: obj[0],
|
||||
name: obj[1] + " (prototypes)",
|
||||
completer: function (a, b) compl(a, b, true)
|
||||
}));
|
||||
|
||||
for (let [, obj] in Iterator(objects)) {
|
||||
let name = obj[1] + " (substrings)";
|
||||
this.context.fork(name, this._top.offset, this, this._fill,
|
||||
obj[0], name, compl,
|
||||
false, filter, last, key.length);
|
||||
}
|
||||
for (let [, obj] in Iterator(objects))
|
||||
this.context.fork(obj[1] + "/substrings", this._top.offset, this, this._fill,
|
||||
update(args, {
|
||||
obj: obj[0],
|
||||
name: obj[1] + " (substrings)",
|
||||
anchored: false,
|
||||
completer: compl
|
||||
}));
|
||||
|
||||
for (let [, obj] in Iterator(objects)) {
|
||||
let name = obj[1] + " (prototype substrings)";
|
||||
this.context.fork(name, this._top.offset, this, this._fill,
|
||||
obj[0], name, function (a, b) compl(a, b, true),
|
||||
false, filter, last, key.length);
|
||||
}
|
||||
for (let [, obj] in Iterator(objects))
|
||||
this.context.fork(obj[1] + "/prototypes/substrings", this._top.offset, this, this._fill,
|
||||
update(args, {
|
||||
obj: obj[0],
|
||||
name: obj[1] + " (prototype substrings)",
|
||||
anchored: false,
|
||||
completer: function (a, b) compl(a, b, true)
|
||||
}));
|
||||
},
|
||||
|
||||
_getKey: function () {
|
||||
@@ -398,7 +419,7 @@ const JavaScript = Module("javascript", {
|
||||
}
|
||||
|
||||
this.context.getCache("evalled", Object);
|
||||
this.context.getCache("evalContext", function () ({ __proto__: userContext }));;
|
||||
this.context.getCache("evalContext", function () ({ __proto__: userContext }));
|
||||
|
||||
// Okay, have parse stack. Figure out what we're completing.
|
||||
|
||||
@@ -478,7 +499,7 @@ const JavaScript = Module("javascript", {
|
||||
for (let [i, idx] in Iterator(this._get(-2).comma)) {
|
||||
let arg = this._str.substring(prev + 1, idx);
|
||||
prev = idx;
|
||||
util.memoize(args, i, function () self.evalled(arg));
|
||||
memoize(args, i, function () self.evalled(arg));
|
||||
}
|
||||
let key = this._getKey();
|
||||
args.push(key + string);
|
||||
|
||||
Reference in New Issue
Block a user