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)",