From e2f498a976c962c6dd20d6065b7632eb12941290 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 4 Mar 2011 17:39:51 -0500 Subject: [PATCH] Fix echo bugs. Closes issue #414. --- common/content/commandline.js | 13 ++++++++----- common/content/mow.js | 13 +++++++++---- common/content/statusline.js | 5 +++-- common/modules/javascript.jsm | 9 +++++---- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/common/content/commandline.js b/common/content/commandline.js index 3ea41a74..b146118b 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -135,7 +135,7 @@ var CommandWidgets = Class("CommandWidgets", { return this.statusbar; let statusElem = this.statusbar.message; - if (value && statusElem.editor && statusElem.editor.rootElement.scrollWidth > statusElem.scrollWidth) + if (value && !value[2] && statusElem.editor && statusElem.editor.rootElement.scrollWidth > statusElem.scrollWidth) return this.commandbar; return this.activeGroup.mode; } @@ -173,7 +173,8 @@ var CommandWidgets = Class("CommandWidgets", { let elem = self.getGroup(obj.name, obj.value)[obj.name]; if (obj.value != null) return [obj.value[0], - obj.get ? obj.get.call(this, elem) : elem.value]; + obj.get ? obj.get.call(this, elem) : elem.value] + .concat(obj.value.slice(2)) return null; }, @@ -670,7 +671,7 @@ var CommandLine = Module("commandline", { * messages move to the MOW. */ _echoLine: function echoLine(str, highlightGroup, forceSingle, silent) { - this.widgets.message = str ? [highlightGroup, str] : null; + this.widgets.message = str ? [highlightGroup, str, forceSingle] : null; dactyl.triggerObserver("echoLine", str, highlightGroup, null, forceSingle); @@ -718,7 +719,7 @@ var CommandLine = Module("commandline", { highlightGroup = highlightGroup || this.HL_NORMAL; if (flags & this.APPEND_TO_MESSAGES) { - let message = isObject(data) ? data : { message: data }; + let message = isObject(data) && !isinstance(data, _) ? data : { message: String(data) }; this._messageHistory.add(update({ highlight: highlightGroup }, message)); data = message.message; } @@ -1684,8 +1685,10 @@ var ItemList = Class("ItemList", { let items = nodes.items; let [start, end, waiting] = getRows(context); - if (context.message) + if (context.message) { + nodes.message.textContent = ""; nodes.message.appendChild(this._dom(context.message)); + } nodes.message.style.display = context.message ? "block" : "none"; nodes.waiting.style.display = waiting ? "block" : "none"; nodes.up.style.opacity = "0"; diff --git a/common/content/mow.js b/common/content/mow.js index 64feba3d..9ace65a3 100644 --- a/common/content/mow.js +++ b/common/content/mow.js @@ -119,15 +119,20 @@ var MOW = Module("mow", { // after interpolated data. XML.ignoreWhitespace = XML.prettyPrinting = false; - if (isObject(data)) { + if (isObject(data) && !isinstance(data, _)) { this.lastOutput = null; var output = util.xmlToDom(
, this.document); data.document = this.document; - output.appendChild(data.message); - - this.messages.push(data); + try { + output.appendChild(data.message); + } + catch (e) { + util.reportError(e); + util.dump(data); + this.messages.push(data); + } } else { let style = isString(data) ? "pre" : "nowrap"; diff --git a/common/content/statusline.js b/common/content/statusline.js index 79607270..54943425 100644 --- a/common/content/statusline.js +++ b/common/content/statusline.js @@ -32,11 +32,12 @@ var StatusLine = Module("statusline", { -moz-appearance: none !important; } - !AddonButton;#addon-bar>xul|toolbarbutton,#addon-bar>xul|toolbarbutton>xul|toolbarbutton { + !AddonButton;#addon-bar xul|toolbarbutton { -moz-appearance: none !important; padding: 0 !important; border-width: 0px !important; min-width: 0 !important; + color: inherit !important; } AddonButton:not(:hover) background: transparent !important; ]]>)({ padding: util.OS.isMacOSX ? "padding-right: 10px !important;" : "" })); @@ -111,7 +112,7 @@ var StatusLine = Module("statusline", { break; case "command": if (link) - dactyl.echo(_("status.link", link), commandline.DISALLOW_MULTILINE); + dactyl.echo(_("status.link", link), commandline.FORCE_SINGLELINE); else commandline.clear(); break; diff --git a/common/modules/javascript.jsm b/common/modules/javascript.jsm index c4b8d27a..733f3d65 100644 --- a/common/modules/javascript.jsm +++ b/common/modules/javascript.jsm @@ -627,7 +627,7 @@ var JavaScript = Module("javascript", { "CSSFontFaceStyleDecl", "CSSGroupRuleRuleList", "CSSNameSpaceRule", "CSSRGBColor", "CSSRect", "ComputedCSSStyleDeclaration", "Date", "Error", "EvalError", "Float32Array", "Float64Array", "Function", - "HTMLDelElement", "HTMLInsElement", "Infinity", + "HTMLDelElement", "HTMLInsElement", "HTMLSpanElement", "Infinity", "InnerModalContentWindow", "InnerWindow", "Int16Array", "Int32Array", "Int8Array", "InternalError", "Iterator", "JSON", "KeyboardEvent", "Math", "NaN", "Namespace", "Number", "Object", "Proxy", "QName", @@ -635,9 +635,10 @@ var JavaScript = Module("javascript", { "StopIteration", "String", "SyntaxError", "TypeError", "URIError", "Uint16Array", "Uint32Array", "Uint8Array", "XML", "XMLHttpProgressEvent", "XMLList", "XMLSerializer", "XPCNativeWrapper", - "XPCSafeJSWrapper", "XULControllers", "decodeURI", "decodeURIComponent", - "encodeURI", "encodeURIComponent", "escape", "eval", "isFinite", "isNaN", - "isXMLName", "parseFloat", "parseInt", "undefined", "unescape", "uneval" + "XPCSafeJSWrapper", "XULControllers", "constructor", "decodeURI", + "decodeURIComponent", "encodeURI", "encodeURIComponent", "escape", + "eval", "isFinite", "isNaN", "isXMLName", "parseFloat", "parseInt", + "undefined", "unescape", "uneval" ].concat([k.substr(6) for (k in keys(Ci)) if (/^nsIDOM/.test(k))]) .concat([k.substr(3) for (k in keys(Ci)) if (/^nsI/.test(k))]) .concat(this.magicalNames)