Scroll immediately to bottom when scrollOnUserInput is enabled

See microsoft/vscode#211199
This commit is contained in:
Daniel Imms
2024-07-11 09:36:22 -07:00
parent 73ee951807
commit 90a1da28bd
3 changed files with 10 additions and 6 deletions
+7 -3
View File
@@ -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;
}
+1 -1
View File
@@ -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({
+2 -2
View File
@@ -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);
}