From 4fa700b3370f2f9372608710293a9a0ec0bfcf83 Mon Sep 17 00:00:00 2001 From: LU XIANGRUI <1078666705@qq.com> Date: Wed, 11 Nov 2026 15:45:16 +0900 Subject: [PATCH] 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> --- e2e/editor.spec.ts | 12 ++++++++++++ src/features/search/bookmarks/gutter.ts | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/e2e/editor.spec.ts b/e2e/editor.spec.ts index 4b7069044..2325724cc 100644 --- a/e2e/editor.spec.ts +++ b/e2e/editor.spec.ts @@ -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); +}); diff --git a/src/features/search/bookmarks/gutter.ts b/src/features/search/bookmarks/gutter.ts index f1b038230..cdd8c4da8 100644 --- a/src/features/search/bookmarks/gutter.ts +++ b/src/features/search/bookmarks/gutter.ts @@ -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)",