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"
}
This commit is contained in:
Moler1995
2026-11-10 23:16:16 +08:00
committed by GitHub
parent 8b32df9773
commit ca9cc64ee8
2 changed files with 14 additions and 1 deletions
+10
View File
@@ -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");
+4 -1
View File
@@ -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(