fix(split-pane): refit Pane B when the window/sidebar/tab-rail resizes

Ark0N's PR #453 review: fit() was only ever called from the divider
drag, and the trailing-edge ResizeObserver callback in terminal-ui.js
(throttledResize) only ever measured Pane A's own container. Split at
a wide viewport, shrink the window (or toggle the Alt+B sidebar, or
drag the tab rail), and Pane A's cols changed while Pane B silently
kept its stale PTY size in both xterm and the real pane.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
timkjr
2026-09-20 13:10:31 -05:00
co-authored by Claude Sonnet 5
parent 7fc66e8161
commit 78dcb0aa24
2 changed files with 6 additions and 69 deletions
+6
View File
@@ -1092,6 +1092,12 @@ Object.assign(CodemanApp.prototype, {
if (this._localEchoOverlay?.hasPending) {
this._localEchoOverlay.rerender();
}
// Pane B (split view) has its own container and its own fit()/resize
// frame — this observer only ever measured Pane A's container, so
// without this call Pane B never learned about a window resize, an
// Alt+B sidebar toggle, or a tab-rail drag, and its PTY silently
// stayed at whatever size it was last dragged to.
this._splitPane?.fit();
}, 300); // Trailing-edge: only fire after 300ms of no resize events
};
@@ -1,69 +0,0 @@
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import { createRouteTestHarness, type RouteTestHarness } from './_route-test-utils.js';
import { registerSystemRoutes } from '../../src/web/routes/system-routes.js';
const { subagentWatcher, imageWatcher, workflowRunWatcher, fileSystem } = vi.hoisted(() => {
const makeWatcher = () => ({
isRunning: vi.fn(() => false),
start: vi.fn(),
stop: vi.fn(),
getStats: vi.fn(() => ({})),
watchSession: vi.fn(),
getRecentRunSummaries: vi.fn(() => []),
});
// Simulate in-memory file storage
let storedSettings: Record<string, unknown> = {};
return {
subagentWatcher: makeWatcher(),
imageWatcher: makeWatcher(),
workflowRunWatcher: makeWatcher(),
fileSystem: {
storedSettings,
},
};
});
vi.mock('node:fs/promises', () => ({
default: {
readFile: vi.fn(async () => JSON.stringify(fileSystem.storedSettings)),
writeFile: vi.fn(async (_path: string, content: string) => {
fileSystem.storedSettings = JSON.parse(content);
}),
},
}));
vi.mock('node:fs', async (importOriginal) => {
const actual = await importOriginal<typeof import('node:fs')>();
return { ...actual, existsSync: vi.fn(() => true), mkdirSync: vi.fn(), readdirSync: vi.fn(() => []) };
});
vi.mock('../../src/subagent-watcher.js', () => ({ subagentWatcher }));
vi.mock('../../src/image-watcher.js', () => ({ imageWatcher }));
vi.mock('../../src/workflow-run-watcher.js', () => ({ workflowRunWatcher }));
describe('showSplitButton setting', () => {
let harness: RouteTestHarness;
beforeEach(async () => {
harness = await createRouteTestHarness(registerSystemRoutes);
});
afterEach(async () => {
await harness.app.close();
});
it('round-trips through PUT and GET /api/settings', async () => {
const putRes = await harness.app.inject({
method: 'PUT',
url: '/api/settings',
payload: { showSplitButton: true },
});
expect(putRes.statusCode).toBe(200);
const getRes = await harness.app.inject({ method: 'GET', url: '/api/settings' });
const body = JSON.parse(getRes.body);
expect(body.showSplitButton).toBe(true);
});
});