mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 04:07:59 +01:00
fixed multiline output display in regressions.js
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
2009:
|
2009:
|
||||||
|
* Jonathan Austin
|
||||||
* Steven Romanow
|
* Steven Romanow
|
||||||
|
|
||||||
2008:
|
2008:
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ var skipTests = [":bmarks", "gg"];
|
|||||||
// Put definitions here which might change due to internal liberator refactoring
|
// Put definitions here which might change due to internal liberator refactoring
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
var doc; // document where we output status messages
|
||||||
var multilineOutput = document.getElementById("liberator-multiline-output")
|
var multilineOutput = document.getElementById("liberator-multiline-output")
|
||||||
var singlelineOutput = document.getElementById("liberator-commandline-command")
|
var singlelineOutput = document.getElementById("liberator-commandline-command")
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ var singlelineOutput = document.getElementById("liberator-commandline-command")
|
|||||||
// A series of Ex commands or mappings, each with a
|
// A series of Ex commands or mappings, each with a
|
||||||
// function checking whether the command succeeded
|
// function checking whether the command succeeded
|
||||||
// If the string starts with a ":" it is executed as an Ex command, otherwise as a mapping
|
// If the string starts with a ":" it is executed as an Ex command, otherwise as a mapping
|
||||||
// You can also mix commands mappings
|
// You can also mix commands and mappings
|
||||||
let tests = [
|
let tests = [
|
||||||
{ cmds: [":!dir"],
|
{ cmds: [":!dir"],
|
||||||
verify: function () getMultilineOutput().length > 10 },
|
verify: function () getMultilineOutput().length > 10 },
|
||||||
@@ -45,6 +46,8 @@ let tests = [
|
|||||||
verify: function () getSinglelineOutput() == "test" },
|
verify: function () getSinglelineOutput() == "test" },
|
||||||
{ cmds: [":qmark V http://test.vimperator.org", ":qmarks"],
|
{ cmds: [":qmark V http://test.vimperator.org", ":qmarks"],
|
||||||
verify: function () getMultilineOutput().indexOf("test.vimperator.org") >= 0 },
|
verify: function () getMultilineOutput().indexOf("test.vimperator.org") >= 0 },
|
||||||
|
{ cmds: [":javascript liberator.echo('test', commandline.FORCE_MULTILINE)"],
|
||||||
|
verify: function () getMultilineOutput() == "test" },
|
||||||
// { cmds: [":echomsg \"testmsg\""],
|
// { cmds: [":echomsg \"testmsg\""],
|
||||||
// verify: function () getOutput() == "testmsg" },
|
// verify: function () getOutput() == "testmsg" },
|
||||||
// { cmds: [":echoerr \"testerr\""],
|
// { cmds: [":echoerr \"testerr\""],
|
||||||
@@ -89,15 +92,14 @@ function getBufferPosition()
|
|||||||
y: win.scrollMaxY ? win.pageYOffset / win.scrollMaxY : 0 }
|
y: win.scrollMaxY ? win.pageYOffset / win.scrollMaxY : 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: need to find a way to wait for page load
|
|
||||||
function getLocation() window.content.document.location.href;
|
function getLocation() window.content.document.location.href;
|
||||||
|
|
||||||
var doc;
|
|
||||||
|
|
||||||
function echoLine(str, group)
|
function echoLine(str, group)
|
||||||
{
|
{
|
||||||
if (!doc)
|
if (!doc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
doc.body.appendChild(util.xmlToDom(
|
doc.body.appendChild(util.xmlToDom(
|
||||||
<div highlight={group} style="border: 1px solid gray; white-space: pre; height: 1.5em; line-height: 1.5em;">{str}</div>,
|
<div highlight={group} style="border: 1px solid gray; white-space: pre; height: 1.5em; line-height: 1.5em;">{str}</div>,
|
||||||
doc));
|
doc));
|
||||||
@@ -106,6 +108,7 @@ function echoMulti(str, group)
|
|||||||
{
|
{
|
||||||
if (!doc)
|
if (!doc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
doc.body.appendChild(util.xmlToDom(<div class="ex-command-output"
|
doc.body.appendChild(util.xmlToDom(<div class="ex-command-output"
|
||||||
style="white-space: nowrap; border: 1px solid black; min-height: 1.5em;"
|
style="white-space: nowrap; border: 1px solid black; min-height: 1.5em;"
|
||||||
highlight={group}>{template.maybeXML(str)}</div>,
|
highlight={group}>{template.maybeXML(str)}</div>,
|
||||||
@@ -126,7 +129,7 @@ commands.addUserCommand(["regr[essions]"],
|
|||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
liberator.registerObserver("echoLine", echoLine);
|
liberator.registerObserver("echoLine", echoLine);
|
||||||
liberator.registerObserver("echoMulti", echoMulti);
|
liberator.registerObserver("echoMultiline", echoMulti);
|
||||||
liberator.open("chrome://liberator/content/buffer.xhtml", liberator.NEW_TAB);
|
liberator.open("chrome://liberator/content/buffer.xhtml", liberator.NEW_TAB);
|
||||||
events.waitForPageLoad();
|
events.waitForPageLoad();
|
||||||
doc = content.document;
|
doc = content.document;
|
||||||
@@ -144,7 +147,7 @@ commands.addUserCommand(["regr[essions]"],
|
|||||||
function cleanup()
|
function cleanup()
|
||||||
{
|
{
|
||||||
liberator.unregisterObserver("echoLine", echoLine);
|
liberator.unregisterObserver("echoLine", echoLine);
|
||||||
liberator.unregisterObserver("echoMulti", echoMulti);
|
liberator.unregisterObserver("echoMultiline", echoMulti);
|
||||||
commandline.updateOutputHeight = updateOutputHeight;
|
commandline.updateOutputHeight = updateOutputHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user