Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/code editor: tweak appearance
Adorian Doranbb6b3862d0db
diff --git a/packages/codemirror/src/index.spec.ts b/packages/codemirror/src/index.spec.tsindex e1b43b3991..a8c3012371 100644--- a/packages/codemirror/src/index.spec.ts+++ b/packages/codemirror/src/index.spec.ts@@ -349,7 +349,7 @@ describe("CodeMirror", () => {expect(hasLineNumbers(editor)).toBe(false);});- it("blends the gutter into the code while the line numbers are off", async () => {+ it("blends an inset gutter into the code while the line numbers are off", async () => {const theme = getThemeById("github-light");expect(theme).not.toBeNull();if (!theme) return;@@ -360,11 +360,13 @@ describe("CodeMirror", () => {expect(hidden).toContain("background-color: transparent;");expect(hidden).toContain("border: none;");expect(hidden).not.toContain("border-right");+ expect(hidden).toContain("padding-inline-start: 8px;");editor.setLineNumbers(true);const [ shown ] = getGutterRules(editor);expect(shown).toContain("background-color: #f6f8fa;");expect(shown).toContain("border-right: 1px solid");+ expect(getGutterRules(editor).join("\n")).not.toContain("padding-inline-start");});it("clamps the indent size to a sane range", () => {diff --git a/packages/codemirror/src/index.ts b/packages/codemirror/src/index.tsindex 4603bf34b9..039f7e7fda 100644--- a/packages/codemirror/src/index.ts+++ b/packages/codemirror/src/index.ts@@ -765,11 +765,13 @@ const loadedThemes = new WeakMap<ThemeDefinition, Extension>();/*** Merges the gutter, which still holds the fold markers, into the code area while the line- * numbers are off. `Prec.highest` outranks the `.cm-gutters` rule of the color theme.+ * numbers are off, and keeps the markers off the edge of the editor. `Prec.highest` outranks the+ * `.cm-gutters` rule of the color theme.*/const hiddenLineNumbersTheme = Prec.highest(EditorView.theme({".cm-gutters": {border: "none",+ paddingInlineStart: "8px",backgroundColor: "transparent"}}));