diff --git a/src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts b/src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts index babe35b4178ae..182345ecf6b57 100644 --- a/src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts +++ b/src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts @@ -41,6 +41,8 @@ export class ViewCursor { private readonly _domNode: FastDomNode; private _cursorStyle: TextEditorCursorStyle; + + private _cursorHeightMultiplier: number; private _lineHeight: number; private _typicalHalfwidthCharacterWidth: number; @@ -59,6 +61,7 @@ export class ViewCursor { this._cursorStyle = this._context.configuration.editor.viewInfo.cursorStyle; this._lineHeight = this._context.configuration.editor.lineHeight; this._typicalHalfwidthCharacterWidth = this._context.configuration.editor.fontInfo.typicalHalfwidthCharacterWidth; + this._cursorHeightMultiplier = this._context.configuration.editor.cursorHeightMultiplier || 1; this._isVisible = true; @@ -69,7 +72,7 @@ export class ViewCursor { } else { this._domNode.setClassName('cursor'); } - this._domNode.setHeight(this._lineHeight); + this._domNode.setHeight(this._lineHeight * this._cursorHeightMultiplier); this._domNode.setTop(0); this._domNode.setLeft(0); Configuration.applyFontInfo(this._domNode, this._context.configuration.editor.fontInfo); @@ -185,7 +188,7 @@ export class ViewCursor { this._domNode.setLeft(this._renderData.left); this._domNode.setWidth(this._renderData.width); this._domNode.setLineHeight(this._lineHeight); - this._domNode.setHeight(this._lineHeight); + this._domNode.setHeight(this._lineHeight * this._cursorHeightMultiplier); return { domNode: this._domNode.domNode, diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index 2d54be1a83297..26baaf991d040 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -192,6 +192,11 @@ const editorConfiguration: IConfigurationNode = { 'default': EDITOR_FONT_DEFAULTS.lineHeight, 'description': nls.localize('lineHeight', "Controls the line height. Use 0 to compute the lineHeight from the fontSize.") }, + 'editor.cursorHeightMultiplier': { + 'type': 'number', + 'default': EDITOR_FONT_DEFAULTS.cursorHeightMultiplier, + 'description': nls.localize('cursorHeightMultiplier', "Controls how tall the cursor is. This will be multiplied with editor.lineHeight.") + }, 'editor.letterSpacing': { 'type': 'number', 'default': EDITOR_FONT_DEFAULTS.letterSpacing, diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index 2daf0ddac8f2e..4d6001a6ab637 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -810,6 +810,7 @@ export class InternalEditorOptions { readonly pixelRatio: number; readonly editorClassName: string; readonly lineHeight: number; + readonly cursorHeightMultiplier: number; readonly readOnly: boolean; /** * @internal @@ -2039,6 +2040,7 @@ export const EDITOR_FONT_DEFAULTS = { ), lineHeight: 0, letterSpacing: 0, + cursorHeightMultiplier: 1 }; /**