mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Scroll immediately to bottom when scrollOnUserInput is enabled
See microsoft/vscode#211199
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user