From f5f3ca8168c113b3c030b447e099a7b88ea109af Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 4 Feb 2014 07:13:35 -0500 Subject: [PATCH] fix(terminal) when back to term, first simbol wasn't wrote --- lib/client/terminal.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/client/terminal.js b/lib/client/terminal.js index de4a98fa..0c73b171 100644 --- a/lib/client/terminal.js +++ b/lib/client/terminal.js @@ -11,6 +11,7 @@ var CloudCmd, Util, DOM, CloudFunc, Terminal; MouseBinded, Term, Key = CloudCmd.Key, + ESC = Key.ESC, Images = DOM.Images, Notify = DOM.Notify, @@ -86,8 +87,7 @@ var CloudCmd, Util, DOM, CloudFunc, Terminal; } function listener(event) { - var keyCode = event.keyCode, - ESC = Key.ESC; + var keyCode = event.keyCode; if (keyCode === ESC) CloudCmd.View.hide(); @@ -105,8 +105,17 @@ var CloudCmd, Util, DOM, CloudFunc, Terminal; Term.on('keydown', listener); Term.on('data', function(data) { - if (data) - socket.emit(CHANNEL, data); + var code; + + if (data) { + code = data.charCodeAt(0); + + /* when back to term + * first simbol wasn't wrote + */ + if (code !== ESC) + socket.emit(CHANNEL, data); + } }); //Term.resize(size.cols, size.rows);