1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 17:57:59 +01:00

inputMultiline method finished (some display bug may remain)

:js <<EOF support is back, better than ever (TM)
This commit is contained in:
Martin Stubenschrott
2007-07-29 03:48:29 +00:00
parent bdc505a047
commit b4dfb2540b
6 changed files with 88 additions and 45 deletions

View File

@@ -488,14 +488,29 @@ function Commands() //{{{
if (special) // open javascript console
vimperator.open("chrome://global/content/console.xul", vimperator.NEW_TAB);
else
try
{
// check for a heredoc
var matches = args.match(/(.*)<<\s*([^\s]+)$/);
if (matches && matches[2])
{
eval(args);
vimperator.commandline.inputMultiline(new RegExp("^" + matches[2] + "$", "m"),
function(code) {
try { eval(matches[1] + "\n" + code); }
catch (e) { vimperator.echoerr(e.name + ": " + e.message); }
});
}
catch (e)
else // single line javascript code
{
vimperator.echoerr(e.name + ": " + e.message);
try
{
eval(args);
}
catch (e)
{
vimperator.echoerr(e.name + ": " + e.message);
}
}
}
},
{
usage: ["javas[cript] {cmd}", "javascript <<{endpattern}\\n{script}\\n{endpattern}", "javascript[!]"], // \\n is changed to <br/> in the help.js code