1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 19:32:27 +01:00

Merge change from key-processing. Closes issue #303.

This commit is contained in:
Kris Maglione
2011-01-24 05:20:34 -05:00
parent 51aa3ebc61
commit 1ec71c11c6

View File

@@ -1224,17 +1224,19 @@ var CommandLine = Module("commandline", {
}, },
withOutputToString: function (fn, self) { withOutputToString: function (fn, self) {
let buffer = [];
dactyl.registerObserver("echoLine", observe, true); dactyl.registerObserver("echoLine", observe, true);
dactyl.registerObserver("echoMultiline", observe, true); dactyl.registerObserver("echoMultiline", observe, true);
let output = [];
function observe(str, highlight, dom) { function observe(str, highlight, dom) {
buffer.push(dom && !isString(str) ? util.domToString(dom) : str); output.push(dom && !isString(str) ? dom : str);
} }
this.savingOutput = true; this.savingOutput = true;
dactyl.trapErrors.apply(dactyl, [fn, self].concat(Array.slice(arguments, 2))); dactyl.trapErrors.apply(dactyl, [fn, self].concat(Array.slice(arguments, 2)));
this.savingOutput = false; this.savingOutput = false;
return buffer.join("\n"); return output.map(function (elem) elem instanceof Node ? util.domToString(elem) : elem)
.join("\n");
} }
}, { }, {
/** /**