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 <26499420+wildcatDownstairs@users.noreply.github.com>
This commit is contained in:
LU XIANGRUI
2026-11-11 14:45:16 +08:00
committed by GitHub
co-authored by wildcatDownstairs
parent 173d5edcdc
commit 4fa700b337
2 changed files with 14 additions and 1 deletions
+12
View File
@@ -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
View File
@@ -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)",