Skip to content

Commit 2a6e22e

Browse files
committed
set this._latestYDisp = undefined onBufferActivate
1 parent 32c3cb0 commit 2a6e22e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/browser/Viewport.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,12 @@ export class Viewport extends Disposable {
9494
}));
9595

9696
this._register(this._bufferService.onResize(() => this.queueSync()));
97-
this._register(this._bufferService.buffers.onBufferActivate(() => this.queueSync()));
97+
this._register(this._bufferService.buffers.onBufferActivate(() => {
98+
// Reset _latestYDisp when switching buffers to prevent stale scroll position
99+
// from alt buffer contaminating normal buffer scroll position
100+
this._latestYDisp = undefined;
101+
this.queueSync();
102+
}));
98103
this._register(this._bufferService.onScroll(() => this._sync()));
99104

100105
this._register(this._scrollableElement.onScroll(e => this._handleScroll(e)));
@@ -160,7 +165,6 @@ export class Viewport extends Disposable {
160165
// If ydisp has been changed by some other component (input/buffer), then stop animating smooth
161166
// scroll and scroll there immediately.
162167
if (ydisp !== this._latestYDisp) {
163-
this._latestYDisp = ydisp;
164168
this._scrollableElement.setScrollPosition({
165169
scrollTop: ydisp * this._renderService.dimensions.css.cell.height
166170
});

0 commit comments

Comments
 (0)