diff --git a/src/browser/CoreBrowserTerminal.ts b/src/browser/CoreBrowserTerminal.ts index ea648557..6755006a 100644 --- a/src/browser/CoreBrowserTerminal.ts +++ b/src/browser/CoreBrowserTerminal.ts @@ -863,8 +863,12 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal { this.scrollLines(-this._bufferService.buffer.ydisp); } - public scrollToBottom(): void { - this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp); + public scrollToBottom(disableSmoothScroll?: boolean): void { + if (disableSmoothScroll && this._viewport) { + this._viewport.scrollToLine(this.buffer.ybase, true); + } else { + this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp); + } } public scrollToLine(line: number): void { @@ -998,7 +1002,7 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal { if (!shouldIgnoreComposition && !this._compositionHelper!.keydown(event)) { if (this.options.scrollOnUserInput && this.buffer.ybase !== this.buffer.ydisp) { - this.scrollToBottom(); + this.scrollToBottom(true); } return false; } diff --git a/src/browser/Viewport.ts b/src/browser/Viewport.ts index 01c6bd9a..64fcba2c 100644 --- a/src/browser/Viewport.ts +++ b/src/browser/Viewport.ts @@ -108,7 +108,7 @@ export class Viewport extends Disposable { } public scrollToLine(line: number, disableSmoothScroll?: boolean): void { - if (!disableSmoothScroll) { + if (disableSmoothScroll) { this._latestYDisp = line; } this._scrollableElement.setScrollPosition({ diff --git a/src/common/CoreTerminal.ts b/src/common/CoreTerminal.ts index 10f3bc18..132be05b 100644 --- a/src/common/CoreTerminal.ts +++ b/src/common/CoreTerminal.ts @@ -130,7 +130,7 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal { this.register(forwardEvent(this._bufferService.onResize, this._onResize)); this.register(forwardEvent(this.coreService.onData, this._onData)); this.register(forwardEvent(this.coreService.onBinary, this._onBinary)); - this.register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom())); + this.register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom(true))); this.register(this.coreService.onUserInput(() => this._writeBuffer.handleUserInput())); this.register(this.optionsService.onMultipleOptionChange(['windowsMode', 'windowsPty'], () => this._handleWindowsPtyOptionChange())); this.register(this._bufferService.onScroll(() => { @@ -206,7 +206,7 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal { this.scrollLines(-this._bufferService.buffer.ydisp); } - public scrollToBottom(): void { + public scrollToBottom(disableSmoothScroll?: boolean): void { this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp); }