From c2aa0d75ec210d50348051492365241f39a884cd Mon Sep 17 00:00:00 2001 From: ayapi Date: Sat, 13 Aug 2016 22:44:56 +0900 Subject: [PATCH] restore customKeydownHandler on reset(RIS) --- src/xterm.js | 2 ++ test/test.js | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/xterm.js b/src/xterm.js index 88096dff..d2e46074 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -3467,7 +3467,9 @@ Terminal.prototype.reset = function() { this.options.rows = this.rows; this.options.cols = this.cols; + var customKeydownHandler = this.customKeydownHandler; Terminal.call(this, this.options); + this.customKeydownHandler = customKeydownHandler; this.refresh(0, this.rows - 1); }; diff --git a/test/test.js b/test/test.js index d2842f81..33a00035 100644 --- a/test/test.js +++ b/test/test.js @@ -88,6 +88,15 @@ describe('xterm.js', function() { }); assert.equal(xterm.keyDown(Object.assign({}, evKeyDown, { keyCode: 77 })), false); }); + + it('should alive after reset(ESC c Full Reset (RIS))', function () { + xterm.attachCustomKeydownHandler(function (ev) { + return ev.keyCode !== 77; + }); + assert.equal(xterm.keyDown(Object.assign({}, evKeyDown, { keyCode: 77 })), false); + xterm.reset(); + assert.equal(xterm.keyDown(Object.assign({}, evKeyDown, { keyCode: 77 })), false); + }); }); describe('evaluateCopiedTextProcessing', function () {