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(