mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Add cursorSmoothCaretAnimation: explicit
(#169113)
Fixes #168857: Add `cursorSmoothCaretAnimation: explicit`
This commit is contained in:
parent
ed36fc536a
commit
8b939ad54b
|
@ -90,6 +90,7 @@ registerSimpleEditorSettingMigration('parameterHints', [[true, { enabled: true }
|
|||
registerSimpleEditorSettingMigration('autoIndent', [[false, 'advanced'], [true, 'full']]);
|
||||
registerSimpleEditorSettingMigration('matchBrackets', [[true, 'always'], [false, 'never']]);
|
||||
registerSimpleEditorSettingMigration('renderFinalNewline', [[true, 'on'], [false, 'off']]);
|
||||
registerSimpleEditorSettingMigration('cursorSmoothCaretAnimation', [[true, 'on'], [false, 'off']]);
|
||||
|
||||
registerEditorSettingMigration('autoClosingBrackets', (value, read, write) => {
|
||||
if (value === false) {
|
||||
|
|
|
@ -25,7 +25,7 @@ export class ViewCursors extends ViewPart {
|
|||
private _readOnly: boolean;
|
||||
private _cursorBlinking: TextEditorCursorBlinkingStyle;
|
||||
private _cursorStyle: TextEditorCursorStyle;
|
||||
private _cursorSmoothCaretAnimation: boolean;
|
||||
private _cursorSmoothCaretAnimation: 'off' | 'explicit' | 'on';
|
||||
private _selectionIsEmpty: boolean;
|
||||
private _isComposingInput: boolean;
|
||||
|
||||
|
@ -117,7 +117,7 @@ export class ViewCursors extends ViewPart {
|
|||
private _onCursorPositionChanged(position: Position, secondaryPositions: Position[], reason: CursorChangeReason): void {
|
||||
const pauseAnimation = (
|
||||
this._secondaryCursors.length !== secondaryPositions.length
|
||||
|| reason !== CursorChangeReason.Explicit
|
||||
|| (this._cursorSmoothCaretAnimation === 'explicit' && reason !== CursorChangeReason.Explicit)
|
||||
);
|
||||
this._primaryCursor.onCursorPositionChanged(position, pauseAnimation);
|
||||
this._updateBlinking();
|
||||
|
|
|
@ -214,9 +214,9 @@ export interface IEditorOptions {
|
|||
mouseStyle?: 'text' | 'default' | 'copy';
|
||||
/**
|
||||
* Enable smooth caret animation.
|
||||
* Defaults to false.
|
||||
* Defaults to 'off'.
|
||||
*/
|
||||
cursorSmoothCaretAnimation?: boolean;
|
||||
cursorSmoothCaretAnimation?: 'off' | 'explicit' | 'on';
|
||||
/**
|
||||
* Control the cursor style, either 'block' or 'line'.
|
||||
* Defaults to 'line'.
|
||||
|
@ -5014,9 +5014,18 @@ export const EditorOptions = {
|
|||
_cursorBlinkingStyleFromString,
|
||||
{ description: nls.localize('cursorBlinking', "Control the cursor animation style.") }
|
||||
)),
|
||||
cursorSmoothCaretAnimation: register(new EditorBooleanOption(
|
||||
EditorOption.cursorSmoothCaretAnimation, 'cursorSmoothCaretAnimation', false,
|
||||
{ description: nls.localize('cursorSmoothCaretAnimation', "Controls whether the smooth caret animation should be enabled.") }
|
||||
cursorSmoothCaretAnimation: register(new EditorStringEnumOption(
|
||||
EditorOption.cursorSmoothCaretAnimation, 'cursorSmoothCaretAnimation',
|
||||
'off' as 'off' | 'explicit' | 'on',
|
||||
['off', 'explicit', 'on'] as const,
|
||||
{
|
||||
enumDescriptions: [
|
||||
nls.localize('cursorSmoothCaretAnimation.off', "Smooth caret animation is disabled."),
|
||||
nls.localize('cursorSmoothCaretAnimation.explicit', "Smooth caret animation is enabled only when the user moves the cursor with an explicit gesture."),
|
||||
nls.localize('cursorSmoothCaretAnimation.on', "Smooth caret animation is always enabled.")
|
||||
],
|
||||
description: nls.localize('cursorSmoothCaretAnimation', "Controls whether the smooth caret animation should be enabled.")
|
||||
}
|
||||
)),
|
||||
cursorStyle: register(new EditorEnumOption(
|
||||
EditorOption.cursorStyle, 'cursorStyle',
|
||||
|
|
6
src/vs/monaco.d.ts
vendored
6
src/vs/monaco.d.ts
vendored
|
@ -3185,9 +3185,9 @@ declare namespace monaco.editor {
|
|||
mouseStyle?: 'text' | 'default' | 'copy';
|
||||
/**
|
||||
* Enable smooth caret animation.
|
||||
* Defaults to false.
|
||||
* Defaults to 'off'.
|
||||
*/
|
||||
cursorSmoothCaretAnimation?: boolean;
|
||||
cursorSmoothCaretAnimation?: 'off' | 'explicit' | 'on';
|
||||
/**
|
||||
* Control the cursor style, either 'block' or 'line'.
|
||||
* Defaults to 'line'.
|
||||
|
@ -4739,7 +4739,7 @@ declare namespace monaco.editor {
|
|||
contextmenu: IEditorOption<EditorOption.contextmenu, boolean>;
|
||||
copyWithSyntaxHighlighting: IEditorOption<EditorOption.copyWithSyntaxHighlighting, boolean>;
|
||||
cursorBlinking: IEditorOption<EditorOption.cursorBlinking, TextEditorCursorBlinkingStyle>;
|
||||
cursorSmoothCaretAnimation: IEditorOption<EditorOption.cursorSmoothCaretAnimation, boolean>;
|
||||
cursorSmoothCaretAnimation: IEditorOption<EditorOption.cursorSmoothCaretAnimation, 'on' | 'off' | 'explicit'>;
|
||||
cursorStyle: IEditorOption<EditorOption.cursorStyle, TextEditorCursorStyle>;
|
||||
cursorSurroundingLines: IEditorOption<EditorOption.cursorSurroundingLines, number>;
|
||||
cursorSurroundingLinesStyle: IEditorOption<EditorOption.cursorSurroundingLinesStyle, 'default' | 'all'>;
|
||||
|
|
Loading…
Reference in a new issue