Skip to content

Commit 1608901

Browse files
committed
Don't scroll terminal to top when hidden and shown
Fixes microsoft#134692
1 parent dda4f43 commit 1608901

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/vs/workbench/contrib/terminal/browser/terminalInstance.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,13 +1171,13 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
11711171
// using cached dimensions of a split terminal).
11721172
this._resize();
11731173

1174-
// Trigger a manual scroll event which will sync the viewport and scroll bar. This is
1174+
// Trigger a forced refresh of the viewport to sync the viewport and scroll bar. This is
11751175
// necessary if the number of rows in the terminal has decreased while it was in the
11761176
// background since scrollTop changes take no effect but the terminal's position does
11771177
// change since the number of visible rows decreases.
11781178
// This can likely be removed after https://github.com/xtermjs/xterm.js/issues/291 is
11791179
// fixed upstream.
1180-
this._xtermCore._onScroll.fire(this._xterm.buffer.active.viewportY);
1180+
this._xtermCore.viewport._innerRefresh();
11811181
}
11821182
}
11831183

src/vs/workbench/contrib/terminal/browser/xterm-private.d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
/* eslint-disable @typescript-eslint/naming-convention */
7+
68
import { IBufferCell } from 'xterm';
79

810
export type XTermAttributes = Omit<IBufferCell, 'getWidth' | 'getChars' | 'getCode'> & { clone?(): XTermAttributes };
911

1012
export interface XTermCore {
11-
_onScroll: IEventEmitter<number>;
13+
viewport: {
14+
_innerRefresh(): void;
15+
};
1216
_onKey: IEventEmitter<{ key: string }>;
1317

1418
_charSizeService: {

0 commit comments

Comments
 (0)