From e7e9923ce168e494891f3f0803a2dbb66ff21096 Mon Sep 17 00:00:00 2001 From: insoln Date: Sun, 7 May 2017 23:42:08 +0100 Subject: [PATCH] Solve issue#33 with losing focus on big changes https://github.com/chjj/term.js/issues/33 --- src/term.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/term.js b/src/term.js index 68bc073..b431d82 100644 --- a/src/term.js +++ b/src/term.js @@ -1413,9 +1413,12 @@ Terminal.prototype.refresh = function(start, end) { this.children[y].innerHTML = out; } - if (parent) parent.appendChild(this.element); + if (parent) { + parent.appendChild(this.element); + this.element.focus(); + } }; - + Terminal.prototype._cursorBlink = function() { if (Terminal.focus !== this) return; this.cursorState ^= 1;