diff --git a/common/content/commandline.js b/common/content/commandline.js index 611e2669..5a8ffdae 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -648,10 +648,9 @@ var CommandLine = Module("commandline", { * @param {XML} xml The output as an E4X XML object. */ commandOutput: function commandOutput(xml) { - XML.ignoreWhitespace = false; - XML.prettyPrinting = false; + XML.ignoreWhitespace = XML.prettyPrinting = false; if (this.command) - this.echo(<>:{this.command}{xml}, this.HIGHLIGHT_NORMAL, this.FORCE_MULTILINE); + this.echo(<>
:{this.command}
{xml}, this.HIGHLIGHT_NORMAL, this.FORCE_MULTILINE); else this.echo(xml, this.HIGHLIGHT_NORMAL, this.FORCE_MULTILINE); this.command = null; diff --git a/common/locale/en-US/styling.xml b/common/locale/en-US/styling.xml index eda39bbf..ff3c7017 100644 --- a/common/locale/en-US/styling.xml +++ b/common/locale/en-US/styling.xml @@ -79,6 +79,7 @@
Enabled
Text indicating enabled status, such as of an extension or style group
ErrorMsg
Error messages
Filter
The matching text in a completion list
+
Find
Text find highlighting. Only background and foreground colors apply.
FrameIndicator
The indicator shown when a new frame is selected
Function
A JavaScript Function object
Hint
A hint indicator. See :help hints
diff --git a/common/modules/config.jsm b/common/modules/config.jsm index bc67e657..4812eb82 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -13,7 +13,7 @@ Components.utils.import("resource://dactyl/bootstrap.jsm"); defineModule("config", { exports: ["ConfigBase", "Config", "config"], require: ["services", "storage", "util", "template"], - use: ["io", "messages", "prefs"] + use: ["io", "messages", "prefs", "styles"] }, this); var ConfigBase = Class("ConfigBase", { @@ -33,9 +33,12 @@ var ConfigBase = Class("ConfigBase", { loadStyles: function loadStyles() { const { highlight } = require("highlight"); + highlight.styleableChrome = this.styleableChrome; + highlight.loadCSS(this.CSS); highlight.loadCSS(this.helpCSS); + if (!util.haveGecko("2b")) highlight.loadCSS(); + + let hl = highlight.set("Find", ""); + hl.onChange = function () { + function hex(val) ("#" + util.regexp.iterate(/\d+/g, val) + .map(function (num) ("0" + Number(num).toString(16)).slice(-2)) + .join("") + ).slice(0, 7); + + let elem = services.appShell.hiddenDOMWindow.document.createElement("div"); + elem.style.cssText = this.cssText; + let style = util.computedStyle(elem); + + let keys = iter(Styles.propertyIter(this.cssText)).map(function (p) p.name).toArray(); + let bg = keys.some(function (k) /^background/.test(k)); + let fg = keys.indexOf("color") >= 0; + + prefs[bg ? "safeSet" : "safeReset"]("ui.textHighlightBackground", hex(style.backgroundColor)); + prefs[fg ? "safeSet" : "safeReset"]("ui.textHighlightForeground", hex(style.color)); + }; }, get addonID() this.name + "@dactyl.googlecode.com", diff --git a/common/modules/highlight.jsm b/common/modules/highlight.jsm index 6142cce5..02020afc 100644 --- a/common/modules/highlight.jsm +++ b/common/modules/highlight.jsm @@ -33,6 +33,8 @@ Highlight.liveProperty = function (name, prop) { h.style.css = h.css; this.style[prop || name] = this[prop || name]; + if (this.onChange) + this.onChange(); }); } Highlight.liveProperty("agent"); diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 16f9b0b6..0a64fd2f 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -1694,7 +1694,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), do { mainThread.processNextEvent(!flush); if (util.interrupted) - throw new Error("Interrupted"); + throw Error("Interrupted"); } while (flush === true && mainThread.hasPendingEvents()); } diff --git a/pentadactyl/NEWS b/pentadactyl/NEWS index 79321c2d..5aca053c 100644 --- a/pentadactyl/NEWS +++ b/pentadactyl/NEWS @@ -134,6 +134,7 @@ - CSS property name completion is now available. [b4] - :delstyle, :styleenable, :styledisable and :styletoggle accept a ! to operate on all styles. [b6] + - Added Find group. [b7] • IMPORTANT option changes: - Option value quoting has changed. List options will no longer be split at quoted commas and the option name,