From 92cc555f14cec0acc6d2da6b148deb996c62cfae Mon Sep 17 00:00:00 2001 From: Luis Oliveira Date: Thu, 12 Oct 2023 13:41:57 +0100 Subject: [PATCH] Fix https://github.com/microsoft/vscode/pull/178795 (#24) --- build/monaco/package.json | 2 +- src/vs/editor/browser/controller/mouseTarget.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/build/monaco/package.json b/build/monaco/package.json index 7170c3e8b502e..dca91c1c044aa 100644 --- a/build/monaco/package.json +++ b/build/monaco/package.json @@ -1,7 +1,7 @@ { "name": "monaco-editor-core", "private": true, - "version": "0.31.1-os", + "version": "0.31.1-os2", "description": "A browser based code editor", "author": "Microsoft Corporation", "license": "MIT", diff --git a/src/vs/editor/browser/controller/mouseTarget.ts b/src/vs/editor/browser/controller/mouseTarget.ts index e6dc5ca034a30..aab294bb4bbd1 100644 --- a/src/vs/editor/browser/controller/mouseTarget.ts +++ b/src/vs/editor/browser/controller/mouseTarget.ts @@ -991,8 +991,14 @@ export function shadowCaretRangeFromPoint(shadowRoot: ShadowRoot, x: number, y: // Grab its rect const rect = el.getBoundingClientRect(); - // And its font - const font = window.getComputedStyle(el, null).getPropertyValue('font'); + // And its font (the computed shorthand font property might be empty, see #3217) + const fontStyle = window.getComputedStyle(el, null).getPropertyValue('font-style'); + const fontVariant = window.getComputedStyle(el, null).getPropertyValue('font-variant'); + const fontWeight = window.getComputedStyle(el, null).getPropertyValue('font-weight'); + const fontSize = window.getComputedStyle(el, null).getPropertyValue('font-size'); + const lineHeight = window.getComputedStyle(el, null).getPropertyValue('line-height'); + const fontFamily = window.getComputedStyle(el, null).getPropertyValue('font-family'); + const font = `${fontStyle} ${fontVariant} ${fontWeight} ${fontSize}/${lineHeight} ${fontFamily}`; // And also its txt content const text = (el as any).innerText;