Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion apps/desktop/e2e/session-workbar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ test('Git changes re-read the workspace after the app regains focus', async ({
await expect(panel.getByText('新增 5 行')).toBeVisible();
});

test('Terminal ownership follows the active Session and stops the old resource', async ({
test('Terminal fits its panel without growing and stops when its Session changes', async ({
window: page,
}) => {
const { composer, sessionId, sidebar } = await createSession(
Expand All @@ -210,6 +210,23 @@ test('Terminal ownership follows the active Session and stops the old resource',
)
.toBe('running');

// Exercise real layout across frames: a Section's implicit grid row used to
// grow with xterm, continuously triggering fit/resize even at an idle prompt.
const fitsPanel = () => terminal.evaluate(async (element) => {
const panel = element.closest('.maka-session-workbar-panel')!;
const host = element.querySelector('.maka-session-terminal-xterm')!;
for (let frame = 0; frame < 12; frame += 1) {
await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));
const bounds = panel.getBoundingClientRect();
const terminalBounds = host.getBoundingClientRect();
if (terminalBounds.height <= 0 || terminalBounds.bottom > bounds.bottom + 1) {
return false;
}
}
return true;
});
await expect.poll(fitsPanel).toBe(true);

await sidebar.getByRole('button', { name: '新任务', exact: true }).click();
await expect(terminal).toHaveCount(0);
await expect
Expand Down
7 changes: 7 additions & 0 deletions apps/desktop/src/renderer/styles/workbar/shell.css
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@
}

.maka-session-workbar-panel[data-overlay] {
display: grid;
/* Section adds an inner wrapper with height: 100%. An implicit auto row
can grow with xterm's content, feeding ResizeObserver -> fit -> resize
back into layout indefinitely. Bound the row to the available panel. */
grid-template-rows: minmax(0, 1fr);
position: relative;
z-index: 1;
overflow: hidden;
Expand All @@ -147,6 +152,8 @@
leaving its own overflow scroller with nothing to scroll. */
display: grid;
grid-template-rows: minmax(0, 1fr);
/* One stretched track, like the frame: the face fills the height and the
column can be aligned as a whole. */
padding-top: var(--maka-plate-titlebar-clearance);
}

Expand Down