Skip to content

Commit

Permalink
Add smooth scrolling setting
Browse files Browse the repository at this point in the history
Fixes #125950
  • Loading branch information
Tyriar committed Aug 3, 2022
1 parent 2f72682 commit d639201
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/vs/platform/terminal/common/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ export const enum TerminalSettingId {
ShellIntegrationDecorationIcon = 'terminal.integrated.shellIntegration.decorationIcon',
ShellIntegrationDecorationIconError = 'terminal.integrated.shellIntegration.decorationIconError',
ShellIntegrationDecorationIconSuccess = 'terminal.integrated.shellIntegration.decorationIconSuccess',
ShellIntegrationCommandHistory = 'terminal.integrated.shellIntegration.history'
ShellIntegrationCommandHistory = 'terminal.integrated.shellIntegration.history',
SmoothScrolling = 'terminal.integrated.smoothScrolling'
}

export const enum TerminalLogConstants {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { IGenericMarkProperties } from 'vs/platform/terminal/common/terminalProc
// which suggests the fallback DOM-based renderer
const SLOW_CANVAS_RENDER_THRESHOLD = 50;
const NUMBER_OF_FRAMES_TO_MEASURE = 20;
const SMOOTH_SCROLL_DURATION = 125;

let CanvasAddon: typeof CanvasAddonType;
let SearchAddon: typeof SearchAddonType;
Expand Down Expand Up @@ -144,7 +145,8 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal, II
fastScrollSensitivity: config.fastScrollSensitivity,
scrollSensitivity: config.mouseWheelScrollSensitivity,
wordSeparator: config.wordSeparators,
overviewRulerWidth: 10
overviewRulerWidth: 10,
smoothScrollDuration: config.smoothScrolling ? SMOOTH_SCROLL_DURATION : 0
}));
this._core = (this.raw as any)._core as IXtermCore;

Expand Down Expand Up @@ -242,6 +244,7 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal, II
this.raw.options.rightClickSelectsWord = config.rightClickBehavior === 'selectWord';
this.raw.options.wordSeparator = config.wordSeparators;
this.raw.options.customGlyphs = config.customGlyphs;
this.raw.options.smoothScrollDuration = config.smoothScrolling ? SMOOTH_SCROLL_DURATION : 0;
if (this._shouldLoadWebgl()) {
this._enableWebglRenderer();
} else {
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/contrib/terminal/common/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ export interface ITerminalConfiguration {
enabled: boolean;
decorationsEnabled: boolean;
};
smoothScrolling: boolean;
}

export const DEFAULT_LOCAL_ECHO_EXCLUDE: ReadonlyArray<string> = ['vim', 'vi', 'nano', 'tmux'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,11 @@ const terminalConfiguration: IConfigurationNode = {
type: 'number',
default: 100
},
[TerminalSettingId.SmoothScrolling]: {
markdownDescription: localize('terminal.integrated.smoothScrolling', "Controls whether the terminal will scroll using an animation."),
type: 'boolean',
default: false
},
}
};

Expand Down

0 comments on commit d639201

Please sign in to comment.