From c18c58d0b089b61768c1b4201bd15db2c9a54c96 Mon Sep 17 00:00:00 2001 From: rebornix Date: Wed, 30 Nov 2016 14:04:52 -0800 Subject: [PATCH] reset cursor width whenever cursor style changes --- src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts b/src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts index 509b3a2745b..787ad18b6cd 100644 --- a/src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts +++ b/src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts @@ -28,6 +28,7 @@ export class ViewCursor { private _isVisible: boolean; private _isInViewport: boolean; private _cursorStyle: TextEditorCursorStyle; + private _cursorStyleChanged: boolean; private _lastRenderedContent: string; private _lineHeight: number; private _characterWidth: number; @@ -35,6 +36,7 @@ export class ViewCursor { constructor(context: ViewContext, isSecondary: boolean) { this._context = context; this._cursorStyle = this._context.configuration.editor.viewInfo.cursorStyle; + this._cursorStyleChanged = false; this._lineHeight = this._context.configuration.editor.lineHeight; this._lastRenderedContent = ''; @@ -116,6 +118,7 @@ export class ViewCursor { } if (e.viewInfo.cursorStyle) { this._cursorStyle = this._context.configuration.editor.viewInfo.cursorStyle; + this._cursorStyleChanged = true; } if (e.fontInfo) { Configuration.applyFontInfo(this._domNode, this._context.configuration.editor.fontInfo); @@ -180,6 +183,9 @@ export class ViewCursor { if (this._domNode.domNode.style.width !== desiredWidth) { this._domNode.domNode.style.width = desiredWidth; } + } else if (this._cursorStyleChanged) { + this._domNode.domNode.style.width = '2px'; + this._cursorStyleChanged = false; } return { -- GitLab