From 183fd2fe79273ffbbf58fba534f0d05946ac7331 Mon Sep 17 00:00:00 2001 From: Daniel Griffen Date: Fri, 16 Feb 2018 10:17:48 -0800 Subject: [PATCH 1/5] fix terminal width calculation --- src/renderer/Renderer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/Renderer.ts b/src/renderer/Renderer.ts index 2408f808..fa1e34e6 100644 --- a/src/renderer/Renderer.ts +++ b/src/renderer/Renderer.ts @@ -121,7 +121,7 @@ export class Renderer extends EventEmitter implements IRenderer { } // Resize the screen - this._terminal.screenElement.style.width = `${this.dimensions.canvasWidth + this._terminal.viewport.scrollBarWidth}px`; + this._terminal.screenElement.style.width = `${this.dimensions.canvasWidth}px`; this._terminal.screenElement.style.height = `${this.dimensions.canvasHeight}px`; this.emit('resize', { From 76a3dbf883272e78831fc9b92be0fedf95c0cbd7 Mon Sep 17 00:00:00 2001 From: Bruno Ribeito Date: Mon, 26 Feb 2018 23:27:53 +0000 Subject: [PATCH 2/5] Enforce option value via types --- typings/xterm.d.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index dd08b55e..2eb732ac 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -487,12 +487,7 @@ declare module 'xterm' { * @param key The option key. */ getOption(key: 'handler'): (data: string) => void; - /** - * Retrieves an option's value from the terminal. - * @param key The option key. - */ - getOption(key: string): any; - + /** * Sets an option on the terminal. * @param key The option key. @@ -548,12 +543,10 @@ declare module 'xterm' { */ setOption(key: 'theme', value: ITheme): void; /** - * Sets an option on the terminal. + * Retrieves an option's value from the terminal. * @param key The option key. - * @param value The option value. */ - setOption(key: string, value: any): void; - + setOption(key: 'cols' | 'rows', value: number): void; /** * Tells the renderer to refresh terminal content between two rows * (inclusive) at the next opportunity. From c51fa238ff956d2d3ad1f376bf34fdd3df1b1d24 Mon Sep 17 00:00:00 2001 From: Bruno Ribeito Date: Tue, 27 Feb 2018 23:18:33 +0000 Subject: [PATCH 3/5] Readd any overloads --- typings/xterm.d.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 2eb732ac..32c8b0a0 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -487,7 +487,12 @@ declare module 'xterm' { * @param key The option key. */ getOption(key: 'handler'): (data: string) => void; - + /** + * Retrieves an option's value from the terminal. + * @param key The option key. + */ + getOption(key: string): any; + /** * Sets an option on the terminal. * @param key The option key. @@ -543,10 +548,18 @@ declare module 'xterm' { */ setOption(key: 'theme', value: ITheme): void; /** - * Retrieves an option's value from the terminal. + * Sets an option on the terminal. * @param key The option key. + * @param value The option value. */ setOption(key: 'cols' | 'rows', value: number): void; + /** + * Sets an option on the terminal. + * @param key The option key. + * @param value The option value. + */ + setOption(key: string, value: any): void; + /** * Tells the renderer to refresh terminal content between two rows * (inclusive) at the next opportunity. From 9e62c8692f5a85c42c4c3aee316cc495c7ab84ba Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 5 Mar 2018 11:11:54 -0800 Subject: [PATCH 4/5] Only move horizontally on alt click in normal buffer Fixes #1305 --- src/Types.ts | 1 + src/handlers/AltClickHandler.ts | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) 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 */ From 7c471f5389cd43365aad3f6972df06b2cf7b56ba Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 5 Mar 2018 11:32:05 -0800 Subject: [PATCH 5/5] Fix test compile --- src/utils/TestUtils.test.ts | 1 + 1 file changed, 1 insertion(+) 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;