diff --git a/src/InputHandler.ts b/src/InputHandler.ts index bc9528e0..e7b21c0f 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -541,9 +541,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Backspace (Ctrl-H). */ public backspace(): void { - if (this._terminal.buffer.x >= this._terminal.cols) { - this._terminal.buffer.x = this._terminal.cols - 1; - } + this._restrictCursor(); if (this._terminal.buffer.x > 0) { this._terminal.buffer.x--; } @@ -587,9 +585,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Insert Ps (Blank) Character(s) (default = 1) (ICH). */ public insertChars(params: IParams): void { - if (this._terminal.buffer.x >= this._terminal.cols) { - this._terminal.buffer.x = this._terminal.cols - 1; - } + this._restrictCursor(); this._terminal.buffer.lines.get(this._terminal.buffer.y + this._terminal.buffer.ybase).insertCells( this._terminal.buffer.x, params.params[0] || 1, @@ -841,6 +837,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Insert Ps Line(s) (default = 1) (IL). */ public insertLines(params: IParams): void { + this._restrictCursor(); let param = params.params[0] || 1; // make buffer local for faster access @@ -868,6 +865,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Delete Ps Line(s) (default = 1) (DL). */ public deleteLines(params: IParams): void { + this._restrictCursor(); let param = params.params[0] || 1; // make buffer local for faster access @@ -959,6 +957,9 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT). */ public cursorBackwardTab(params: IParams): void { + if (this._terminal.buffer.x >= this._terminal.cols) { + return; + } let param = params.params[0] || 1; // make buffer local for faster access @@ -2017,6 +2018,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Moves the cursor down one line in the same column. */ public index(): void { + this._restrictCursor(); this._terminal.index(); // TODO: save to move from terminal? } @@ -2039,6 +2041,7 @@ export class InputHandler extends Disposable implements IInputHandler { * the page scrolls down. */ public reverseIndex(): void { + this._restrictCursor(); this._terminal.reverseIndex(); // TODO: save to move from terminal? } diff --git a/src/Terminal2.test.ts b/src/Terminal2.test.ts index fe291656..8c560761 100644 --- a/src/Terminal2.test.ts +++ b/src/Terminal2.test.ts @@ -116,7 +116,7 @@ if (os.platform() !== 'win32') { // 't0051-IL.in', // 't0052-DL.in', // 't0055-EL.in', - 't0056-ED.in', + // 't0056-ED.in', // 't0060-DECSC.in', // 't0061-CSI_s.in', 't0070-DECSTBM_LF.in',