From 20dacef26194c6737986a9f21dba7eb995132938 Mon Sep 17 00:00:00 2001 From: Dan Armendariz Date: Thu, 5 Jan 2017 13:51:49 +0000 Subject: [PATCH] Use newline event to prevent buffer from clearing --- plugins/c9.ide.terminal/aceterm/aceterm.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/plugins/c9.ide.terminal/aceterm/aceterm.js b/plugins/c9.ide.terminal/aceterm/aceterm.js index 4b8f67ba..400e1ba3 100644 --- a/plugins/c9.ide.terminal/aceterm/aceterm.js +++ b/plugins/c9.ide.terminal/aceterm/aceterm.js @@ -277,10 +277,12 @@ define(function(require, exports, module) { var command = monitor.getCommand(row); if (command) { // wait for \n to know what command was typed - term.on("afterWrite", waitForNewLine); + term.once("newline", function() { + monitor.$command = monitor.getCommand(monitor.lastCommandRow).trim(); + }); term.lines[row].isUserInput = true; monitor.lastCommandRow = row; - monitor.$command = monitor.getCommand(monitor.lastCommandRow); + monitor.$command = monitor.getCommand(monitor.lastCommandRow).trim(); } } @@ -298,17 +300,6 @@ define(function(require, exports, module) { }); } }); - function waitForNewLine(data) { - var index = data.indexOf("\n"); - if (index >= 0) { - session.term.off("afterWrite", waitForNewLine); - monitor.$command += data.substr(0, index); - monitor.$command = monitor.$command.trim(); - } - else { - monitor.$command += data; - } - } var monitor = { lastCommandRow: -1,