Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(editor): disable code editor font ligatures

Melody Rucha559371fc9f4
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",
},