mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Fix teleport issue when coming back from alt buffer
This commit is contained in:
@@ -46,6 +46,9 @@ export class MockBufferService implements IBufferService {
|
||||
public scrollLines(disp: number, suppressScrollEvent?: boolean): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
public syncScrollPosition(): void {
|
||||
// Mock implementation - no-op for tests
|
||||
}
|
||||
public resize(cols: number, rows: number): void {
|
||||
this.cols = cols;
|
||||
this.rows = rows;
|
||||
|
||||
@@ -91,6 +91,8 @@ export class BufferSet extends Disposable implements IBufferSet {
|
||||
activeBuffer: this._normal,
|
||||
inactiveBuffer: this._alt
|
||||
});
|
||||
// Prevent scrollbar "teleport" to top of the terminal, from previous alt buffer.
|
||||
this._bufferService.syncScrollPosition();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -148,4 +148,11 @@ export class BufferService extends Disposable implements IBufferService {
|
||||
this._onScroll.fire(buffer.ydisp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronize the scroll position by firing a scroll event with the current buffer's ydisp.
|
||||
*/
|
||||
public syncScrollPosition(): void {
|
||||
this._onScroll.fire(this.buffer.ydisp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ export interface IBufferService {
|
||||
onScroll: Event<number>;
|
||||
scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;
|
||||
scrollLines(disp: number, suppressScrollEvent?: boolean): void;
|
||||
syncScrollPosition(): void;
|
||||
resize(cols: number, rows: number): void;
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user