From c15fed382df67cfb2302e876887ef2aa28300487 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 21 Nov 2016 14:04:13 -0800 Subject: [PATCH] Evaluate the custom keydown event handler before scrolling down Fixes #368 --- src/xterm.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xterm.js b/src/xterm.js index 85efc223..d47da683 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -2425,15 +2425,15 @@ Terminal.prototype.attachCustomKeydownHandler = function(customKeydownHandler) { * @param {KeyboardEvent} ev The keydown event to be handled. */ Terminal.prototype.keyDown = function(ev) { + if (this.customKeydownHandler && this.customKeydownHandler(ev) === false) { + return false; + } + // Scroll down to prompt, whenever the user presses a key. if (this.ybase !== this.ydisp) { this.scrollToBottom(); } - if (this.customKeydownHandler && this.customKeydownHandler(ev) === false) { - return false; - } - if (!this.compositionHelper.keydown.bind(this.compositionHelper)(ev)) { return false; }