From a559371fc9f48f10a92c01794b010d19a7592802 Mon Sep 17 00:00:00 2001 From: Melody Ruch <396921921@qq.com> Date: Fri, 4 Sep 2026 16:55:08 +0800 Subject: [PATCH] fix(editor): disable code editor font ligatures --- .../desktop/src/lib/__tests__/editorThemes.spec.ts | 14 ++++++++++++++ apps/desktop/src/lib/editor/editorThemes.ts | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/apps/desktop/src/lib/__tests__/editorThemes.spec.ts b/apps/desktop/src/lib/__tests__/editorThemes.spec.ts index 890b91495a..5311d459de 100644 --- a/apps/desktop/src/lib/__tests__/editorThemes.spec.ts +++ b/apps/desktop/src/lib/__tests__/editorThemes.spec.ts @@ -202,3 +202,17 @@ describe("editor gutters", () => { }); }); }); + +describe("editor font theme", () => { + it("disables ligatures on the editor content so repainted character runs stay stable", () => { + const rules = buildEditorFontThemeRules(); + + // Ligature fonts merge runs like `--`/`==` into one glyph and can race + // CodeMirror's per-keystroke span patching (dbx#7900); dropping either + // declaration would reintroduce unpainted characters in the query editor. + expect(rules[".cm-content"]).toMatchObject({ + fontVariantLigatures: "none", + fontFeatureSettings: '"liga" 0, "calt" 0', + }); + }); +}); diff --git a/apps/desktop/src/lib/editor/editorThemes.ts b/apps/desktop/src/lib/editor/editorThemes.ts index c563912ea1..fa84263bb2 100644 --- a/apps/desktop/src/lib/editor/editorThemes.ts +++ b/apps/desktop/src/lib/editor/editorThemes.ts @@ -763,6 +763,16 @@ export function buildEditorFontThemeRules(opts?: { fixedHeight?: boolean; scroll ...(opts?.scrollable ? { ".cm-scroller": { overflowX: "auto", overflowY: "auto" } } : {}), ".cm-content": { fontFamily: `var(${EDITOR_FONT_FAMILY_CSS_VAR}, ${defaults?.family ?? "monospace"})`, + // Ligature fonts (Fira Code, Cascadia Code, JetBrains Mono, ...) combine + // runs like `--`/`==` into a single shaped glyph. CodeMirror repaints + // edited lines by patching individual character spans, and that + // per-keystroke patching can race the browser's ligature reshaping when + // the same character is typed repeatedly in place, leaving earlier + // characters unpainted until something else forces a repaint (dbx#7900). + // Disabling ligatures here avoids the reshaping entirely, matching the + // same fix already applied to DataGridConditionEditor.vue. + fontVariantLigatures: "none", + fontFeatureSettings: '"liga" 0, "calt" 0', lineHeight: "1.6", padding: "0", },