From 987f09d88051e97ab399c8b9ae826d46d95d178b Mon Sep 17 00:00:00 2001 From: TDaglis Date: Mon, 26 Oct 2015 15:07:15 +0000 Subject: [PATCH 1/3] auto emit blur and focus of textarea --- src/xterm.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/xterm.js b/src/xterm.js index bae41c2b..c5050f07 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -40,7 +40,7 @@ } else { /* * Plain browser environment - */ + */ this.Xterm = xterm.call(this); this.Terminal = this.Xterm; /* Backwards compatibility with term.js */ } @@ -394,7 +394,6 @@ this.showCursor(); this.textarea.focus(); - this.emit('focus', {terminal: this}); }; Terminal.prototype.blur = function() { @@ -408,8 +407,6 @@ if (this.sendFocus) { this.send('\x1b[O'); } - - this.emit('blur', {terminal: this}); }; /** @@ -559,6 +556,12 @@ this.textarea.setAttribute('autocapitalize', 'off'); this.textarea.setAttribute('spellcheck', 'false'); this.textarea.tabIndex = 0; + this.textarea.onfocus = function() { + self.emit('focus', {terminal: self}); + } + this.textarea.onblur = function() { + self.emit('blur', {terminal: self}); + } this.helperContainer.appendChild(this.textarea); for (; i < this.rows; i++) { @@ -2379,7 +2382,7 @@ this.emit('keydown', ev); this.emit('key', key, ev); - this.showCursor(); + this.showCursor(); this.handler(key); return this.cancel(ev); @@ -4784,4 +4787,4 @@ Terminal.cancel = cancel; return Terminal; -}); \ No newline at end of file +}); From 556140e7d97f80c993eec325503ce13226c4d987 Mon Sep 17 00:00:00 2001 From: TDaglis Date: Mon, 26 Oct 2015 17:07:34 +0200 Subject: [PATCH 2/3] added .editorconfig --- .editorconfig | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..d756aefc --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.js] +max_line_length = 100 + +[*.md] +trim_trailing_whitespace = false From cc950614c5a735e848e59c50d5ba226fc7ec6ac5 Mon Sep 17 00:00:00 2001 From: TDaglis Date: Mon, 26 Oct 2015 17:13:04 +0200 Subject: [PATCH 3/3] blur textarea on terminal blur --- src/xterm.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/xterm.js b/src/xterm.js index c5050f07..515e976d 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -403,6 +403,7 @@ this.cursorState = 0; this.refresh(this.y, this.y); + this.textarea.blur(); if (this.sendFocus) { this.send('\x1b[O');