From ca9cc64ee80741ee0433211b064520c980e682e9 Mon Sep 17 00:00:00 2001 From: Moler1995 <36740242+Moler1995@users.noreply.github.com> Date: Tue, 10 Nov 2026 23:16:16 +0800 Subject: [PATCH] fix(plugins): keep line-marker gutter icons inside their column (#2481) Line-marker buttons reuse the indexed-marker button class, whose theme sized every icon to 16px; in the 14px line-marker column, which clips to its width, every icon lost a pixel column on both sides. The 16px size now applies only inside the indexed-marker gutter. Fixes #2479 { "message": "Not Found", "documentation_url": "https://docs.github.com/rest", "status": "404" } --- e2e/pluginMarkerIcons.spec.ts | 10 ++++++++++ src/features/plugins/indexedMarkers.ts | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/e2e/pluginMarkerIcons.spec.ts b/e2e/pluginMarkerIcons.spec.ts index 8e67692fe..60499e7ef 100644 --- a/e2e/pluginMarkerIcons.spec.ts +++ b/e2e/pluginMarkerIcons.spec.ts @@ -72,6 +72,16 @@ test("plugin markers render names and package SVG variants and keep the indexed await expect(markers.locator('[title="Database marker"] svg')).toHaveAttribute("data-icon", "database"); const custom = markers.locator('[title="Package marker"] svg'); await expect(custom).toHaveAttribute("data-icon", /^ext:pluginIcon\/hello\//); + // CodeMirror clips every gutter column to its width (`overflow: hidden`), so an icon wider than + // the column loses its edges: each line-marker icon stays inside the 14px column. + const outside = await markers.evaluate((column) => { + const bounds = column.getBoundingClientRect(); + return [...column.querySelectorAll("svg")].filter((svg) => { + const box = svg.getBoundingClientRect(); + return box.left < bounds.left - 0.5 || box.right > bounds.right + 0.5; + }).length; + }); + expect(outside).toBe(0); await page.evaluate(async () => { const path = "/src/workbench/theme.ts"; await (await import(path)).setTheme("dark"); diff --git a/src/features/plugins/indexedMarkers.ts b/src/features/plugins/indexedMarkers.ts index 94ec9fae8..b650d73b7 100644 --- a/src/features/plugins/indexedMarkers.ts +++ b/src/features/plugins/indexedMarkers.ts @@ -97,7 +97,10 @@ export function indexedMarkers(path: string): Extension { display: "flex", alignItems: "center", }, - ".cm-plugin-mapping-button svg": { width: "16px", height: "16px" }, + // Only the indexed-marker column sizes its icons to 16px. Line markers reuse the button class + // in their own 14px column (lineMarkerGutter.ts, LineMarkers.module.css), whose `overflow: hidden` + // would clip an icon this size at its edges. + ".cm-plugin-mapping-gutter .cm-plugin-mapping-button svg": { width: "16px", height: "16px" }, ".cm-plugin-mapping-button:focus-visible": { outline: "1px solid var(--accent)" }, }), ViewPlugin.fromClass(