fix(editor): collapse the bookmark gutter fully in files without bookmarks (#2632)

The bookmark gutter's 2px side padding applied to the empty spacer element too, so the column kept 4px in files without bookmarks. The padding now applies only to elements that hold a marker, so the column is 0px until the file has a bookmark.

Co-authored-by: wildcatDownstairs <[email protected]>
Цей коміт міститься в:
LU XIANGRUIтаwildcatDownstairs authored and GitHub committed 2026-11-11 14:45:16 +08:00
1 джерело 173d5edcdc
коміт 4fa700b337
2 files changed
+14 -1

No files matched your search

+12
Переглянути файл
@@ -210,3 +210,15 @@ test("Markdown preview highlights ⌘F matches and selected word occurrences", a
)
.toEqual({ current: ["Order"], other: ["Order", "Order"] });
});
test("the bookmark gutter takes no width until the file has a bookmark", async ({ workbench: page }) => {
const editor = await openFromTree(page, "README.md");
const column = editor.locator(".cm-gutter.cm-openidea-bookmarks");
const width = () => column.evaluate((el) => el.getBoundingClientRect().width);
await expect.poll(width).toBe(0);
await editor.locator(".cm-content").click();
await page.keyboard.press("F3");
await expect(column.locator(".cm-openidea-bookmark")).toBeVisible();
await expect.poll(width).toBeGreaterThan(0);
});
+2 -1
Переглянути файл
@@ -172,8 +172,9 @@ const theme = EditorView.baseTheme({
alignItems: "center",
// Spare width stays left of the bookmark, which sits next to the code.
justifyContent: "flex-end",
padding: "0 2px",
},
// Not on the empty spacer, so the column collapses fully in files without bookmarks.
".cm-openidea-bookmarks .cm-gutterElement:not(:empty)": { padding: "0 2px" },
".cm-openidea-bookmark": {
fill: "none",
stroke: "var(--accent)",