дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 09:41:34 +02:00
fix(terminal): restore scrollbar slider inset and theme tokens (#8148)
Цей коміт міститься в:
1 джерело
2389f55bae
коміт
63f20ce5cc
6 files changed
+72
-11
No files matched your search
@@ -851,3 +851,57 @@ test("resizing the terminal keeps a single scrollbar for scrollback", async ({ w
|
||||
)
|
||||
.toBe(true);
|
||||
});
|
||||
|
||||
test("terminal scrollbar slider matches the IDE scrollbar width and tokens", async ({ workbench: page }) => {
|
||||
await page.evaluate(async () => {
|
||||
const layout = await import("/src/workbench/toolwindows/store.ts" as string);
|
||||
layout.moveToolWindow("terminal", "bottom");
|
||||
layout.setToolWindowSize("bottom", 220);
|
||||
layout.showToolWindow("terminal", true);
|
||||
});
|
||||
const terminal = page.getByRole("region", { name: "Terminal", exact: true });
|
||||
await expect(terminal.locator(".xterm-screen")).toBeVisible();
|
||||
await page.evaluate(async () => {
|
||||
const { activeSession } = await import("/src/features/terminal/runtime.ts" as string);
|
||||
await new Promise<void>((resolve) => activeSession().term.write("scrollback\r\n".repeat(120), resolve));
|
||||
});
|
||||
const slider = terminal.locator(".xterm-scrollbar.xterm-vertical .xterm-slider");
|
||||
await expect(slider).toBeVisible();
|
||||
|
||||
const expected = await page.evaluate(() => {
|
||||
const probe = document.createElement("div");
|
||||
probe.style.color = "var(--scrollbar-thumb)";
|
||||
probe.style.backgroundColor = "var(--scrollbar-thumb-hover)";
|
||||
document.body.append(probe);
|
||||
const cs = getComputedStyle(probe);
|
||||
const result = { thumb: cs.color, thumbHover: cs.backgroundColor };
|
||||
probe.remove();
|
||||
return result;
|
||||
});
|
||||
|
||||
// 10px track with a 2px transparent border clipped to content-box → 6px visible pill, matching global.css.
|
||||
await expect(slider).toHaveCSS("width", "10px");
|
||||
await expect(slider).toHaveCSS("border-left-width", "2px");
|
||||
await expect(slider).toHaveCSS("border-right-width", "2px");
|
||||
await expect(slider).toHaveCSS("background-clip", "content-box");
|
||||
await expect(slider).toHaveCSS("background-color", expected.thumb);
|
||||
|
||||
// Reveal xterm's auto-hiding scrollbar before hovering the slider (it fades to pointer-events: none when idle).
|
||||
await terminal.locator(".xterm-screen").hover();
|
||||
await expect(terminal.locator(".xterm-scrollbar.xterm-vertical")).toHaveClass(/xterm-visible/);
|
||||
await slider.hover();
|
||||
await expect(slider).toHaveCSS("background-clip", "content-box");
|
||||
await expect(slider).toHaveCSS("background-color", expected.thumbHover);
|
||||
|
||||
const box = await slider.boundingBox();
|
||||
expect(box).not.toBeNull();
|
||||
await page.mouse.move(box!.x + box!.width / 2, box!.y + box!.height / 2);
|
||||
await page.mouse.down();
|
||||
try {
|
||||
await expect(slider).toHaveClass(/xterm-active/);
|
||||
await expect(slider).toHaveCSS("background-clip", "content-box");
|
||||
await expect(slider).toHaveCSS("background-color", expected.thumbHover);
|
||||
} finally {
|
||||
await page.mouse.up();
|
||||
}
|
||||
});
|
||||
@@ -96,6 +96,7 @@ it.each([
|
||||
try {
|
||||
expect(terminal.options.windowsPty).toEqual(expected);
|
||||
expect(terminal.options.reflowCursorLine).toBe(reflowCursorLine);
|
||||
expect(terminal.options.scrollbar).toEqual({ width: 10 });
|
||||
} finally {
|
||||
term.dispose();
|
||||
}
|
||||
|
||||
@@ -63,6 +63,8 @@ export function createEmbeddedTerminal(host: HTMLElement, opts: EmbeddedTerminal
|
||||
drawBoldTextInBrightColors: false,
|
||||
minimumContrastRatio: MIN_CONTRAST_RATIO,
|
||||
smoothScrollDuration: 0,
|
||||
// Same width as the IDE's scrollbars (global.css); the slider is styled to match in xtermInput.css.
|
||||
scrollbar: { width: 10 },
|
||||
convertEol: false,
|
||||
theme: readTerminalTheme(),
|
||||
});
|
||||
|
||||
@@ -383,7 +383,7 @@ export class TerminalSession {
|
||||
drawBoldTextInBrightColors: false,
|
||||
minimumContrastRatio: MIN_CONTRAST_RATIO,
|
||||
smoothScrollDuration: 0,
|
||||
// Same width as the IDE's scrollbars (global.css); the slider is styled there too (Terminal.module.css).
|
||||
// Same width as the IDE's scrollbars (global.css); the slider is styled to match in xtermInput.css.
|
||||
scrollbar: { width: 10 },
|
||||
theme: readTerminalTheme(),
|
||||
linkHandler: LINK_HANDLER,
|
||||
|
||||
@@ -41,13 +41,3 @@
|
||||
.xterm-decoration-container {
|
||||
pointer-events: none;
|
||||
}
|
||||
.xterm .xterm-scrollable-element > .xterm-scrollbar > .xterm-slider {
|
||||
box-sizing: border-box;
|
||||
border: 2px solid transparent;
|
||||
border-radius: 6px;
|
||||
background: var(--scrollbar-thumb) content-box;
|
||||
}
|
||||
.xterm .xterm-scrollable-element > .xterm-scrollbar > .xterm-slider:hover,
|
||||
.xterm .xterm-scrollable-element > .xterm-scrollbar > .xterm-slider.xterm-active {
|
||||
background: var(--scrollbar-thumb-hover) content-box;
|
||||
}
|
||||
@@ -44,3 +44,17 @@
|
||||
.xterm.openidea-terminal-path-hover.enable-mouse-events {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Match the IDE's 10px scrollbar with a 2px transparent inset (global.css).
|
||||
`.terminal.xterm` outranks xterm's injected `.xterm .xterm-scrollable-element > .xterm-scrollbar > .xterm-slider`
|
||||
rules, whose `background` shorthand otherwise resets `background-clip` to `border-box`. */
|
||||
.terminal.xterm > .xterm-scrollable-element > .xterm-scrollbar > .xterm-slider {
|
||||
box-sizing: border-box;
|
||||
border: 2px solid transparent;
|
||||
border-radius: 6px;
|
||||
background: var(--scrollbar-thumb) content-box;
|
||||
}
|
||||
.terminal.xterm > .xterm-scrollable-element > .xterm-scrollbar > .xterm-slider:hover,
|
||||
.terminal.xterm > .xterm-scrollable-element > .xterm-scrollbar > .xterm-slider.xterm-active {
|
||||
background: var(--scrollbar-thumb-hover) content-box;
|
||||
}
|
||||
Reference in new issue
Заблокувати користувача