diff --git a/src/Types.ts b/src/Types.ts index be292dbf..f0185123 100644 --- a/src/Types.ts +++ b/src/Types.ts @@ -252,6 +252,7 @@ export interface IBuffer { tabs: any; scrollBottom: number; scrollTop: number; + hasScrollback: boolean; savedY: number; savedX: number; isCursorInViewport: boolean; diff --git a/src/handlers/AltClickHandler.ts b/src/handlers/AltClickHandler.ts index c9c51cbe..7af32ee6 100644 --- a/src/handlers/AltClickHandler.ts +++ b/src/handlers/AltClickHandler.ts @@ -56,9 +56,13 @@ export class AltClickHandler { * then moves to requested col. */ private _arrowSequences(): string { - return this._resetStartingRow() + - this._moveToRequestedRow() + - this._moveToRequestedCol(); + // The alt buffer should try to navigate between rows + if (!this._terminal.buffer.hasScrollback) { + return this._resetStartingRow() + this._moveToRequestedRow() + this._moveToRequestedCol(); + } + + // Only move horizontally for the normal buffer + return this._moveHorizontallyOnly(); } /** @@ -113,6 +117,11 @@ export class AltClickHandler { ).length, this._sequence(direction)); } + private _moveHorizontallyOnly(): string { + let direction = this._horizontalDirection(); + return repeat(Math.abs(this._startCol - this._endCol), this._sequence(direction)); + } + /** * Utility functions */ diff --git a/src/utils/TestUtils.test.ts b/src/utils/TestUtils.test.ts index 8ba16179..8d12120b 100644 --- a/src/utils/TestUtils.test.ts +++ b/src/utils/TestUtils.test.ts @@ -276,6 +276,7 @@ export class MockBuffer implements IBuffer { lines: ICircularList<[number, string, number, number][]>; ydisp: number; ybase: number; + hasScrollback: boolean; y: number; x: number; tabs: any;