From 9bcd60cb52e7ea73926278e614b0ac887fb15b0f Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 25 Sep 2010 16:30:52 -0400 Subject: [PATCH] Fix MIW. --- common/content/commandline.js | 22 +++++++++++++++++++--- common/content/io.js | 7 +------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/common/content/commandline.js b/common/content/commandline.js index 240ad7d2..078e274f 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -144,8 +144,15 @@ const CommandLine = Module("commandline", { this._input = {}; this.registerCallback("submit", modes.EX, function (command) { - commands.repeat = command; - dactyl.execute(command); + try { + var readHeredoc = io.readHeredoc; + io.readHeredoc = commandline.readHeredoc; + commands.repeat = command; + dactyl.execute(command); + } + finally { + io.readHeredoc = readHeredoc; + } }); this.registerCallback("complete", modes.EX, function (context) { context.fork("ex", 0, completion, "ex"); @@ -576,6 +583,15 @@ const CommandLine = Module("commandline", { this._completions = CommandLine.Completions(this.widgets.command.inputField); }, + readHeredoc: function (end) { + let args; + commandline.inputMultiline(end, + function (res) { args = res; }); + while (args === undefined) + util.threadYield(true); + return args; + }, + /** * Get a multiline input from a user, up to but not including the line * which matches the given regular expression. Then execute the @@ -702,7 +718,7 @@ const CommandLine = Module("commandline", { if (event.type == "keypress") { let key = events.toString(event); if (events.isAcceptKey(key)) { - let text = "\n" + this.widgets.multilineInput.value.substr(0, this.widgets.multilineInput.selectionStart); + let text = "\n" + this.widgets.multilineInput.value.substr(0, this.widgets.multilineInput.selectionStart) + "\n"; let index = text.indexOf(this._multilineEnd); if (index >= 0) { text = text.substring(1, index); diff --git a/common/content/io.js b/common/content/io.js index 55757fc0..b34622cf 100644 --- a/common/content/io.js +++ b/common/content/io.js @@ -208,12 +208,7 @@ const IO = Module("io", { }, readHeredoc: function (end) { - let args; - commandline.inputMultiline(end, - function (res) { args = res; }); - while (args === undefined) - util.threadYield(true); - return args; + return ""; }, /**