Skip to content

Commit d639201

Browse files
committed
Add smooth scrolling setting
Fixes #125950
1 parent 2f72682 commit d639201

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

src/vs/platform/terminal/common/terminal.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ export const enum TerminalSettingId {
112112
ShellIntegrationDecorationIcon = 'terminal.integrated.shellIntegration.decorationIcon',
113113
ShellIntegrationDecorationIconError = 'terminal.integrated.shellIntegration.decorationIconError',
114114
ShellIntegrationDecorationIconSuccess = 'terminal.integrated.shellIntegration.decorationIconSuccess',
115-
ShellIntegrationCommandHistory = 'terminal.integrated.shellIntegration.history'
115+
ShellIntegrationCommandHistory = 'terminal.integrated.shellIntegration.history',
116+
SmoothScrolling = 'terminal.integrated.smoothScrolling'
116117
}
117118

118119
export const enum TerminalLogConstants {

src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { IGenericMarkProperties } from 'vs/platform/terminal/common/terminalProc
4242
// which suggests the fallback DOM-based renderer
4343
const SLOW_CANVAS_RENDER_THRESHOLD = 50;
4444
const NUMBER_OF_FRAMES_TO_MEASURE = 20;
45+
const SMOOTH_SCROLL_DURATION = 125;
4546

4647
let CanvasAddon: typeof CanvasAddonType;
4748
let SearchAddon: typeof SearchAddonType;
@@ -144,7 +145,8 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal, II
144145
fastScrollSensitivity: config.fastScrollSensitivity,
145146
scrollSensitivity: config.mouseWheelScrollSensitivity,
146147
wordSeparator: config.wordSeparators,
147-
overviewRulerWidth: 10
148+
overviewRulerWidth: 10,
149+
smoothScrollDuration: config.smoothScrolling ? SMOOTH_SCROLL_DURATION : 0
148150
}));
149151
this._core = (this.raw as any)._core as IXtermCore;
150152

@@ -242,6 +244,7 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal, II
242244
this.raw.options.rightClickSelectsWord = config.rightClickBehavior === 'selectWord';
243245
this.raw.options.wordSeparator = config.wordSeparators;
244246
this.raw.options.customGlyphs = config.customGlyphs;
247+
this.raw.options.smoothScrollDuration = config.smoothScrolling ? SMOOTH_SCROLL_DURATION : 0;
245248
if (this._shouldLoadWebgl()) {
246249
this._enableWebglRenderer();
247250
} else {

src/vs/workbench/contrib/terminal/common/terminal.ts

+1
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ export interface ITerminalConfiguration {
302302
enabled: boolean;
303303
decorationsEnabled: boolean;
304304
};
305+
smoothScrolling: boolean;
305306
}
306307

307308
export const DEFAULT_LOCAL_ECHO_EXCLUDE: ReadonlyArray<string> = ['vim', 'vi', 'nano', 'tmux'];

src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts

+5
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,11 @@ const terminalConfiguration: IConfigurationNode = {
569569
type: 'number',
570570
default: 100
571571
},
572+
[TerminalSettingId.SmoothScrolling]: {
573+
markdownDescription: localize('terminal.integrated.smoothScrolling', "Controls whether the terminal will scroll using an animation."),
574+
type: 'boolean',
575+
default: false
576+
},
572577
}
573578
};
574579

0 commit comments

Comments
 (0)