Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ describe('xterm.js', function() {
it('should scroll down, when a key is pressed and terminal is scrolled up', function () {
// Override evaluateKeyEscapeSequence to return cancel code
xterm.evaluateKeyEscapeSequence = function() {
return { cancel: true };
return { key: 'a' };
};
var event = {
type: 'keydown',
Expand All @@ -200,6 +200,7 @@ describe('xterm.js', function() {

xterm.ydisp = 0;
xterm.ybase = 40;
assert.notEqual(xterm.ydisp, xterm.ybase);
xterm.keyDown(event);

// Ensure that now the terminal is scrolled to bottom
Expand Down
21 changes: 0 additions & 21 deletions src/utils/Keyboard.test.ts

This file was deleted.

22 changes: 0 additions & 22 deletions src/utils/Keyboard.ts

This file was deleted.

13 changes: 8 additions & 5 deletions src/xterm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2430,12 +2430,10 @@ Terminal.prototype.keyDown = function(ev) {
return false;
}

// Scroll down to prompt, whenever the user presses a key.
if (!Keyboard.isModifierOnlyKeyboardEvent(ev) && this.ybase !== this.ydisp) {
this.scrollToBottom();
}

if (!this.compositionHelper.keydown.bind(this.compositionHelper)(ev)) {
if (this.ybase !== this.ydisp) {
this.scrollToBottom();
}
return false;
}

Expand All @@ -2460,6 +2458,11 @@ Terminal.prototype.keyDown = function(ev) {
return true;
}

// Scroll down to prompt, whenever the user presses a key.
if (this.ybase !== this.ydisp) {
this.scrollToBottom();
}

this.emit('keydown', ev);
this.emit('key', result.key, ev);
this.showCursor();
Expand Down