From c7ba9d6c8dafa74eee5f35d9111e029d88e41f0f Mon Sep 17 00:00:00 2001
From: Kris Maglione
Date: Wed, 26 Jan 2011 18:11:24 -0500
Subject: [PATCH 1/6] Fix bug in dtd generation.
---
common/modules/config.jsm | 1 +
1 file changed, 1 insertion(+)
diff --git a/common/modules/config.jsm b/common/modules/config.jsm
index 71d25426..e75186bf 100644
--- a/common/modules/config.jsm
+++ b/common/modules/config.jsm
@@ -124,6 +124,7 @@ var ConfigBase = Class("ConfigBase", {
}),
dtd: memoize({
+ get name() config.name,
get home() "http://dactyl.sourceforge.net/",
get apphome() this.home + this.name,
code: "http://code.google.com/p/dactyl/",
From 2b03f03dfe972c4bf929d8f26d19a52f7e7b81db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?=
Date: Thu, 27 Jan 2011 01:37:36 +0100
Subject: [PATCH 2/6] Add information about official plugins to :h intro.
Update issue 315
There you go.
---
common/locale/en-US/intro.xml | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/common/locale/en-US/intro.xml b/common/locale/en-US/intro.xml
index 34f42b04..4c0114f9 100644
--- a/common/locale/en-US/intro.xml
+++ b/common/locale/en-US/intro.xml
@@ -45,7 +45,16 @@
-Contact
+Official Plugins
+
+
+ In case you're not sufficiently overwhelmed by &dactyl.appName;'s default
+ feature set, don't despair. You can find more entertainment in the
+ officially supported (read: you can flame us when they stop working)
+ plugins.
+
+
+Contact
Please send comments, questions, or patches to the
From 90c2ded6455346950be1da6017c8094780c54297 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?=
Date: Thu, 27 Jan 2011 01:38:59 +0100
Subject: [PATCH 3/6] Tag the remaining NEWS entries with appropriate version
information.
---
pentadactyl/NEWS | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/pentadactyl/NEWS b/pentadactyl/NEWS
index 7895a01a..6eefd36b 100644
--- a/pentadactyl/NEWS
+++ b/pentadactyl/NEWS
@@ -75,7 +75,7 @@
listing keys for modes other than Normal, filtering the output
and linking to source code locations). [b4]
- :downloads now opens a download list in the multi-line output
- buffer.
+ buffer. [b6]
- Added :mapgroup command and -group flag to :map, :unmap, and
:mapclear. [b6]
- :extensions has been replaced with a more powerful :addons.
@@ -99,10 +99,10 @@
- Added :write !cmd and :write >>file. [b3]
- Added :yank command. [b3]
- :delmarks, :marks and :qmarks now also accept ranges, same as
- :delqmarks.
- - :command now accepts comma-separated alternative command names.
+ :delqmarks. [b4]
+ - :command now accepts comma-separated alternative command names. [b4]
- :command -complete custom now also accepts a completions array, see
- :h :command-completion-custom.
+ :h :command-completion-custom. [b4]
* Improvements to :style and :highlight:
- Added -link flag to :highlight. [b4]
- Added -agent flag to :style. [b2]
@@ -138,8 +138,8 @@
* IMPORTANT: Plugins are now loaded from the 'plugins/'
directory in 'runtimepath' rather than 'plugin/'. [b1]
* Option changes:
- - Added "bookmarks", "diverted", and "links" to 'activate' [b2]
- option.
+ - Added "bookmarks", "diverted", and "links" to 'activate'
+ option. [b2]
- Added 'altwildmode' and c_ command-line key binding. [b2]
- Added 'autocomplete' option for specifying which completion
groups should be auto-completed. [b2]
From 8db7f4c1e5ecbeca74bcf5911fc2c2026de229f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?=
Date: Thu, 27 Jan 2011 01:40:14 +0100
Subject: [PATCH 4/6] Minor documentation fixes.
---
common/locale/en-US/intro.xml | 4 +---
common/locale/en-US/map.xml | 3 ++-
common/locale/en-US/options.xml | 32 +++++++++++++++++---------------
common/modules/services.jsm | 6 ++++--
4 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/common/locale/en-US/intro.xml b/common/locale/en-US/intro.xml
index 4c0114f9..09fc4afa 100644
--- a/common/locale/en-US/intro.xml
+++ b/common/locale/en-US/intro.xml
@@ -60,9 +60,7 @@
Please send comments, questions, or patches to the
mailing list,
where we will do our best to answer any inquiries. You can also
- check the
- wiki or
- FAQ.
+ find more information on the homepage.
Issue reports can be entered in the
issue tracker.
diff --git a/common/locale/en-US/map.xml b/common/locale/en-US/map.xml
index 2a0bfd21..a6d1dd87 100644
--- a/common/locale/en-US/map.xml
+++ b/common/locale/en-US/map.xml
@@ -46,7 +46,7 @@
- Standard key mapping commands are provided for the four most
+ Standard key mapping commands are provided for the five most
common modes,
@@ -65,6 +65,7 @@
prefixed with one of the above letters. For instance,
:imap creates a new key mapping in insert mode, while
:cunmap removes a key mapping from command-line mode.
+ Other modes can be specified using the -modes option described below.
diff --git a/common/locale/en-US/options.xml b/common/locale/en-US/options.xml
index c11a047a..2fd55ebf 100644
--- a/common/locale/en-US/options.xml
+++ b/common/locale/en-US/options.xml
@@ -443,8 +443,8 @@
-
-
'cookieaccept' 'ca'
- 'cookieaccept'
+ 'ca' 'cookieaccept'
+ 'cookieaccept' 'ca'
string
all
@@ -575,7 +575,7 @@
-
'enc' 'encoding'
- 'encoding'
+ 'encoding' 'enc'
string
UTF-8
@@ -602,7 +602,7 @@
-
'ei' 'eventignore'
- 'eventignore'
+ 'eventignore' 'ei'
stringlist
@@ -658,7 +658,7 @@
-
'fenc' 'fileencoding'
- 'fileencoding'
+ 'fileencoding' 'fenc'
string
UTF-8
@@ -671,7 +671,7 @@
-
'fc' 'findcase'
- 'findcase'
+ 'findcase' 'fc'
string
smart
@@ -939,6 +939,7 @@
-
+
'nojsd' 'nojsdebugger'
'jsd' 'jsdebugger'
'jsdebugger' 'jsd'
boolean
@@ -951,8 +952,8 @@
-
-
'nolpl' 'lpl'
- 'noloadplugins' 'loadplugins'
+ 'nolpl' 'noloadplugins'
+ 'lpl' 'loadplugins'
'loadplugins' 'lpl'
regexplist
'\.(js|&dactyl.fileExt;)$'
@@ -991,7 +992,7 @@
-
'ml' 'mapleader'
- 'mapleader'
+ 'mapleader' 'ml'
string
\
@@ -1247,8 +1248,8 @@
-
-
'sanitizeshutdown' 'ss'
- 'sanitizeshutdown'
+ 'ss' 'sanitizeshutdown'
+ 'sanitizeshutdown' 'ss'
stringlist
@@ -1296,7 +1297,7 @@
-
-
'shell' 'sh'
+ 'sh' 'shell'
'shell' 'sh'
string
$SHELL or sh , Windows: cmd.exe
@@ -1306,7 +1307,7 @@
-
-
'shellcmdflag' 'shcf'
+ 'shcf' 'shellcmdflag'
'shellcmdflag' 'shcf'
string
@@ -1392,6 +1393,7 @@
-
+
'notmo' 'notimeout'
'tmo' 'timeout'
'timeout' 'tmo'
boolean
@@ -1435,7 +1437,7 @@
-
'us' 'urlsep' 'urlseparator'
- 'urlseparator'
+ 'urlseparator' 'urlsep' 'us'
string
\|
@@ -1533,7 +1535,7 @@
-
-
'wildignore' 'wig'
+ 'wig' 'wildignore'
'wildignore' 'wig'
regexplist
diff --git a/common/modules/services.jsm b/common/modules/services.jsm
index 48629933..6c38529b 100644
--- a/common/modules/services.jsm
+++ b/common/modules/services.jsm
@@ -124,7 +124,7 @@ var Services = Module("Services", {
* @param {string} class The class's contract ID.
* @param {nsISupports|nsISupports[]} ifaces The interface or array of
* interfaces implemented by this service.
- * @param {string} meth The name of the function used to instanciate
+ * @param {string} meth The name of the function used to instantiate
* the service.
*/
add: function (name, class_, ifaces, meth) {
@@ -138,9 +138,11 @@ var Services = Module("Services", {
* Adds a new XPCOM class to the cache.
*
* @param {string} name The class's cache key.
- * @param {string} class The class's contract ID.
+ * @param {string} class_ The class's contract ID.
* @param {nsISupports|nsISupports[]} ifaces The interface or array of
* interfaces implemented by this class.
+ * @param {string} init Name of a property or method used to initialise the
+ * class. See {@link #_create}.
*/
addClass: function (name, class_, ifaces, init) {
const self = this;
From 197850aeca9dbd79cd35fdfd31bbf2f2b9c69f30 Mon Sep 17 00:00:00 2001
From: Kris Maglione
Date: Wed, 26 Jan 2011 19:53:46 -0500
Subject: [PATCH 5/6] Fix strictfocus edgecase when the content window is
editable.
--HG--
extra : transplant_source : B4%F6%E1a%0A%0Eo8u%DC%A0%E8%27%01%E1%8A%FF3Z
---
common/content/buffer.js | 2 +-
common/content/dactyl.js | 1 +
common/content/events.js | 35 +++++++++++++++++------------------
3 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/common/content/buffer.js b/common/content/buffer.js
index 05223fe4..df6e2329 100644
--- a/common/content/buffer.js
+++ b/common/content/buffer.js
@@ -551,7 +551,7 @@ var Buffer = Module("buffer", {
* @returns {boolean}
*/
focusAllowed: function (elem) {
- if (elem instanceof Window && !Editor.getEditor(window))
+ if (elem instanceof Window && !Editor.getEditor(elem))
return true;
let doc = elem.ownerDocument || elem.document || elem;
return !options["strictfocus"] || doc.dactylFocusAllowed;
diff --git a/common/content/dactyl.js b/common/content/dactyl.js
index a24ae25b..50339829 100644
--- a/common/content/dactyl.js
+++ b/common/content/dactyl.js
@@ -482,6 +482,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
let win = document.commandDispatcher.focusedWindow;
let elem = config.mainWidget || content;
+
// TODO: make more generic
try {
if (this.has("mail") && !config.isComposeWindow) {
diff --git a/common/content/events.js b/common/content/events.js
index 130b9aa1..bc2b1e63 100644
--- a/common/content/events.js
+++ b/common/content/events.js
@@ -960,32 +960,31 @@ var Events = Module("events", {
// the main window does not restore focus and we lose key
// input.
services.focus.clearFocus(window);
- document.commandDispatcher.focusedWindow = content;
+ document.commandDispatcher.focusedWindow = Editor.getEditor(content) ? window : content;
}
},
// TODO: Merge with onFocusChange
focus: function onFocus(event) {
let elem = event.originalTarget;
- if (elem instanceof Element) {
- let win = elem.ownerDocument.defaultView;
- if (event.target instanceof Ci.nsIDOMXULTextBoxElement)
- for (let e = elem; e instanceof Element; e = e.parentNode)
- if (util.computedStyle(e).visibility !== "visible" ||
- e.boxObject && e.boxObject.height === 0) {
- elem.blur();
- break;
- }
-
- if (events.isContentNode(elem) && !buffer.focusAllowed(elem)
- && !(services.focus.getLastFocusMethod(win) & 0x7000)
- && isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, Window])) {
- if (elem.frameElement)
- dactyl.focusContent(true);
- else if (!(elem instanceof Window) || Editor.getEditor(elem))
+ if (event.target instanceof Ci.nsIDOMXULTextBoxElement)
+ for (let e = elem; e instanceof Element; e = e.parentNode)
+ if (util.computedStyle(e).visibility !== "visible" ||
+ e.boxObject && e.boxObject.height === 0) {
elem.blur();
- }
+ break;
+ }
+
+ let win = (elem.ownerDocument || elem).defaultView || elem;
+
+ if (events.isContentNode(elem) && !buffer.focusAllowed(elem)
+ && !(services.focus.getLastFocusMethod(win) & 0x7000)
+ && isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, Window])) {
+ if (elem.frameElement)
+ dactyl.focusContent(true);
+ else if (!(elem instanceof Window) || Editor.getEditor(elem))
+ dactyl.focus(window);
}
},
From 9403511795b298b1f70e83f5f2c7c821588077d9 Mon Sep 17 00:00:00 2001
From: Kris Maglione
Date: Thu, 27 Jan 2011 01:44:18 -0500
Subject: [PATCH 6/6] Fix addons.jsm on FF36.
---
common/content/commandline.js | 42 ++++++++++++++++++++---------------
common/content/dactyl.js | 4 ++--
common/content/events.js | 12 +++++-----
common/content/modes.js | 26 ++++++++++------------
common/modules/addons.jsm | 22 +++++++++---------
common/modules/completion.jsm | 34 +++++++++++++++-------------
6 files changed, 73 insertions(+), 67 deletions(-)
diff --git a/common/content/commandline.js b/common/content/commandline.js
index 08f091ff..976b04d5 100644
--- a/common/content/commandline.js
+++ b/common/content/commandline.js
@@ -42,7 +42,7 @@ var CommandWidgets = Class("CommandWidgets", {
+ highlight="Normal Events" events="multilineInputEvents" />
@@ -88,6 +88,7 @@ var CommandWidgets = Class("CommandWidgets", {
this.addElement({
name: "command",
+ test: function (stack, prev) stack.pop && !isinstance(prev.main, modes.COMMAND_LINE),
id: "commandline-command",
get: function (elem) {
// The long path is because of complications with the
@@ -163,6 +164,7 @@ var CommandWidgets = Class("CommandWidgets", {
if (!(obj.noValue || obj.getValue)) {
Object.defineProperty(this, obj.name, Modes.boundProperty({
+ test: obj.test,
get: function get_widgetValue() {
let elem = self.getGroup(obj.name, obj.value)[obj.name];
@@ -569,9 +571,6 @@ var CommandLine = Module("commandline", {
nodeSet.commandline.completionList.visible = false;
},
- _multilineEnd: Modes.boundProperty(),
- _multilineCallback: Modes.boundProperty(),
-
_lastClearable: Modes.boundProperty(),
messages: Modes.boundProperty(),
@@ -759,20 +758,21 @@ var CommandLine = Module("commandline", {
* callback with that string as a parameter.
*
* @param {string} end
- * @param {function(string)} callbackFunc
+ * @param {function(string)} callback
*/
// FIXME: Buggy, especially when pasting.
- inputMultiline: function inputMultiline(end, callbackFunc) {
+ inputMultiline: function inputMultiline(end, callback) {
let cmd = this.command;
- modes.push(modes.COMMAND_LINE, modes.INPUT_MULTILINE, {
- keyModes: [modes.INPUT_MULTILINE]
+ modes.push(modes.INPUT_MULTILINE, null, {
+ mappingSelf: {
+ end: "\n" + end + "\n",
+ callback: callback
+ }
});
if (cmd != false)
this._echoLine(cmd, this.HL_NORMAL);
// save the arguments, they are needed in the event handler onKeyPress
- this._multilineEnd = "\n" + end + "\n";
- this._multilineCallback = callbackFunc;
this.multilineInputVisible = true;
this.widgets.multilineInput.value = "";
@@ -781,23 +781,25 @@ var CommandLine = Module("commandline", {
this.timeout(function () { dactyl.focus(this.widgets.multilineInput); }, 10);
},
+ get commandMode() this.commandSession && isinstance(modes.main, modes.COMMAND_LINE),
+
events: update(
iter(CommandMode.prototype.events).map(
function ([event, handler]) [
event, function (event) {
- if (this.commandSession)
+ if (this.commandMode)
handler.call(this.commandSession, event);
}
]).toObject(),
{
blur: function onBlur(event) {
this.timeout(function () {
- if (this.commandSession && event.originalTarget === this.widgets.active.command.inputField)
+ if (this.commandMode && event.originalTarget === this.widgets.active.command.inputField)
dactyl.focus(this.widgets.active.command.inputField);
});
},
focus: function onFocus(event) {
- if (!this.commandSession
+ if (!this.commandMode
&& event.originalTarget === this.widgets.active.command.inputField) {
event.target.blur();
dactyl.beep();
@@ -816,7 +818,7 @@ var CommandLine = Module("commandline", {
*/
multilineInputEvents: {
blur: function onBlur(event) {
- if (modes.extended & modes.INPUT_MULTILINE)
+ if (modes.main == modes.INPUT_MULTILINE)
this.timeout(function () {
dactyl.focus(this.widgets.multilineInput.inputField);
});
@@ -1355,6 +1357,11 @@ var CommandLine = Module("commandline", {
bases: [modes.COMMAND_LINE],
input: true
});
+
+ modes.addMode("INPUT_MULTILINE", {
+ bases: [modes.INSERT],
+ input: true
+ });
},
mappings: function init_mappings() {
@@ -1364,18 +1371,17 @@ var CommandLine = Module("commandline", {
mappings.add([modes.INPUT_MULTILINE],
["", "", ""], "Begin a new line",
- function (args) {
+ function ({ self }) {
let text = "\n" + commandline.widgets.multilineInput
.value.substr(0, commandline.widgets.multilineInput.selectionStart)
+ "\n";
- let index = text.indexOf(commandline._multilineEnd);
+ let index = text.indexOf(self.end);
if (index >= 0) {
text = text.substring(1, index);
- let callback = commandline._multilineCallback;
modes.pop();
- return function () callback.call(commandline, text);
+ return function () self.callback.call(commandline, text);
}
return Events.PASS;
});
diff --git a/common/content/dactyl.js b/common/content/dactyl.js
index 50339829..73fabff2 100644
--- a/common/content/dactyl.js
+++ b/common/content/dactyl.js
@@ -326,7 +326,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
if (typeof str == "object" && "echoerr" in str)
str = str.echoerr;
else if (isinstance(str, ["Error"]))
- str = <>{str.fileName.replace(/^.*? -> /, "")}: {str.lineNumber}: {str}>;
+ str = <>{str.fileName.replace(/^.* -> /, "")}: {str.lineNumber}: {str}>;
if (options["errorbells"])
dactyl.beep();
@@ -1131,7 +1131,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
});
params = params || {};
- if (isArray(params))
+ if (isString(params))
params = { where: params };
let flags = 0;
diff --git a/common/content/events.js b/common/content/events.js
index bc2b1e63..7be1d152 100644
--- a/common/content/events.js
+++ b/common/content/events.js
@@ -138,7 +138,7 @@ var ProcessorStack = Class("ProcessorStack", {
if (result === Events.KILL)
this.actions = [];
- else if (!this.actions.length)
+ else if (!this.actions.length && !processors.length)
for (let input in values(this.processors))
if (input.fallthrough) {
if (result === Events.KILL)
@@ -1330,11 +1330,11 @@ var Events = Module("events", {
};
},
mappings: function () {
- mappings.add(modes.all,
+ mappings.add(modes.MAIN,
["", ""], "Temporarily ignore all " + config.appName + " key bindings",
function () { modes.push(modes.PASS_THROUGH); });
- mappings.add(modes.all,
+ mappings.add(modes.MAIN,
["", ""], "Pass through next key",
function () {
if (modes.main == modes.QUOTE)
@@ -1342,12 +1342,12 @@ var Events = Module("events", {
modes.push(modes.QUOTE);
});
- mappings.add(modes.all,
+ mappings.add(modes.BASE,
[""], "Do nothing",
function () {});
// macros
- mappings.add([modes.NORMAL, modes.TEXT_AREA, modes.PLAYER].filter(util.identity),
+ mappings.add([modes.COMMAND],
["q", ""], "Record a key sequence into a macro",
function ({ arg }) {
events._macroKeys.pop();
@@ -1355,7 +1355,7 @@ var Events = Module("events", {
},
{ get arg() !modes.recording });
- mappings.add([modes.NORMAL, modes.TEXT_AREA, modes.PLAYER].filter(util.identity),
+ mappings.add([modes.COMMAND],
["@", ""], "Play a macro",
function ({ arg, count }) {
count = Math.max(count, 1);
diff --git a/common/content/modes.js b/common/content/modes.js
index fe9b0275..012cb280 100644
--- a/common/content/modes.js
+++ b/common/content/modes.js
@@ -110,7 +110,7 @@ var Modes = Module("modes", {
this.addMode("INPUT", {
char: "I",
description: "The base mode for input modes, including Insert and Command Line",
- bases: [this.BASE],
+ bases: [this.MAIN],
input: true
});
this.addMode("INSERT", {
@@ -154,11 +154,6 @@ var Modes = Module("modes", {
input: true
});
- this.addMode("INPUT_MULTILINE", {
- extended: true,
- hidden: true,
- input: true
- });
this.addMode("LINE", {
extended: true, hidden: true
});
@@ -269,11 +264,11 @@ var Modes = Module("modes", {
delayed: [],
delay: function (callback, self) { this.delayed.push([callback, self]); },
- save: function save(id, obj, prop) {
+ save: function save(id, obj, prop, test) {
if (!(id in this.boundProperties))
for (let elem in array.iterValues(this._modeStack))
- elem.saved[id] = { obj: obj, prop: prop, value: obj[prop] };
- this.boundProperties[id] = { obj: Cu.getWeakReference(obj), prop: prop };
+ elem.saved[id] = { obj: obj, prop: prop, value: obj[prop], test: test };
+ this.boundProperties[id] = { obj: Cu.getWeakReference(obj), prop: prop, test: test };
},
// helper function to set both modes in one go
@@ -299,15 +294,17 @@ var Modes = Module("modes", {
let push = mainMode != null && !(stack && stack.pop) &&
Modes.StackElement(this._main, this._extended, params, {});
+
if (push && this.topOfStack) {
if (this.topOfStack.params.leave)
dactyl.trapErrors("leave", this.topOfStack.params,
{ push: push }, push);
- for (let [id, { obj, prop }] in Iterator(this.boundProperties)) {
+
+ for (let [id, { obj, prop, test }] in Iterator(this.boundProperties)) {
if (!obj.get())
delete this.boundProperties[id];
else
- this.topOfStack.saved[id] = { obj: obj.get(), prop: prop, value: obj.get()[prop] };
+ this.topOfStack.saved[id] = { obj: obj.get(), prop: prop, value: obj.get()[prop], test: test };
}
}
@@ -319,8 +316,9 @@ var Modes = Module("modes", {
this._modeStack.push(push);
if (stack && stack.pop)
- for (let { obj, prop, value } in values(this.topOfStack.saved))
- obj[prop] = value;
+ for (let { obj, prop, value, test } in values(this.topOfStack.saved))
+ if (!test || !test(stack, prev))
+ obj[prop] = value;
this.show();
@@ -460,7 +458,7 @@ var Modes = Module("modes", {
return val === undefined ? value : val;
},
set: function (val) {
- modes.save(id, this, prop);
+ modes.save(id, this, prop, desc.test);
if (desc.set)
value = desc.set.call(this, val);
value = !desc.set || value === undefined ? val : value;
diff --git a/common/modules/addons.jsm b/common/modules/addons.jsm
index 8fbbba32..2cd642a8 100644
--- a/common/modules/addons.jsm
+++ b/common/modules/addons.jsm
@@ -232,17 +232,6 @@ var Addon = Class("Addon", {
}
});
-iter.forEach(properties(config.addon), function (prop) {
- let desc = Object.getOwnPropertyDescriptor(config.addon, prop);
- if (callable(desc.value))
- Addon.prototype[prop] = function proxy() this.addon[prop].apply(this.addon, arguments);
- else
- Object.defineProperty(Addon.prototype, prop, {
- get: function get_proxy() this.addon[prop],
- set: function set_proxy(val) this.addon[prop] = val
- });
-});
-
var AddonList = Class("AddonList", {
init: function init(modules, types, filter) {
this.modules = modules;
@@ -533,6 +522,17 @@ var addonErrors = array.toObject([
endModule();
+iter.forEach(properties(config.addon), function (prop) {
+ let desc = Object.getOwnPropertyDescriptor(config.addon, prop);
+ if (callable(desc.value))
+ Addon.prototype[prop] = function proxy() this.addon[prop].apply(this.addon, arguments);
+ else
+ Object.defineProperty(Addon.prototype, prop, {
+ get: function get_proxy() this.addon[prop],
+ set: function set_proxy(val) this.addon[prop] = val
+ });
+});
+
} catch(e){ if (isString(e)) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
diff --git a/common/modules/completion.jsm b/common/modules/completion.jsm
index 7c352d1b..9f291f02 100644
--- a/common/modules/completion.jsm
+++ b/common/modules/completion.jsm
@@ -83,7 +83,7 @@ var CompletionContext = Class("CompletionContext", {
self.waitingForTab = false;
delete self._generate;
- delete self._ignoreCase;
+ delete self.ignoreCase;
if (self != this)
return self;
["_caret", "contextList", "maxItems", "onUpdate", "selectionTypes", "tabPressed", "updateAsync", "value"].forEach(function (key) {
@@ -305,7 +305,7 @@ var CompletionContext = Class("CompletionContext", {
get filter() this._filter != null ? this._filter : this.value.substr(this.offset, this.caret),
set filter(val) {
- delete this._ignoreCase;
+ delete this.ignoreCase;
return this._filter = val;
},
@@ -401,18 +401,15 @@ var CompletionContext = Class("CompletionContext", {
this.noUpdate = false;
},
- get ignoreCase() {
- if (this._ignoreCase == null) {
- let mode = this.wildcase;
- if (mode == "match")
- this._ignoreCase = false;
- if (mode == "ignore")
- this._ignoreCase = true;
- this._ignoreCase = !/[A-Z]/.test(this.filter);
- }
- return this._ignoreCase;
- },
- set ignoreCase(val) this._ignoreCase = val,
+ ignoreCase: Class.memoize(function () {
+ let mode = this.wildcase;
+ if (mode == "match")
+ return false;
+ else if (mode == "ignore")
+ return true;
+ else
+ return !/[A-Z]/.test(this.filter);
+ }),
/**
* Returns a list of all completion items which match the current
@@ -483,8 +480,13 @@ var CompletionContext = Class("CompletionContext", {
filtered = filtered.slice(0, this.maxItems);
// Sorting
- if (this.sortResults && this.compare)
+ if (this.sortResults && this.compare) {
filtered.sort(this.compare);
+ if (!this.anchored) {
+ let filter = this.filter;
+ filtered.sort(function (a, b) (b.text.indexOf(filter) == 0) - (a.text.indexOf(filter) == 0));
+ }
+ }
return this.cache.filtered = filtered;
}
@@ -573,7 +575,7 @@ var CompletionContext = Class("CompletionContext", {
* @param {number} count The number of characters to advance the context.
*/
advance: function advance(count) {
- delete this._ignoreCase;
+ delete this.ignoreCase;
let advance = count;
if (this.quote && count) {
advance = this.quote[1](this.filter.substr(0, count)).length;