Fix teleport issue when coming back from alt buffer

This commit is contained in:
Anthony Kim
2025-08-27 20:45:52 -07:00
parent 4c0cf27cfc
commit a3ab942ea1
4 changed files with 13 additions and 0 deletions
+3
View File
@@ -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;
+2
View File
@@ -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();
}
/**
+7
View File
@@ -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);
}
}
+1
View File
@@ -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;
}