Compare commits

...
Author SHA1 Message Date
Cursor Agentand陈大猫 8f1951e0ca docs(terminal): use an ASCII arrow in the workspace ctx comment
AGENTS.md keeps comments ASCII-only. The keep-activeTabId note used a
Unicode arrow.

Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com>
2026-10-24 07:22:50 +00:00
Cursor Agentand陈大猫 5e600085a9 docs(terminal): keep activeTabId in workspace ctx equality
Solo tab switches already leave TerminalPanesHost equal when the sessions
ref is unchanged. Reveal flush and repaint still run on the visible pane,
so removing activeTabId would not move the measured settle time.

Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com>
2026-10-24 07:06:42 +00:00
2 changed files with 28 additions and 0 deletions

No files matched your search

@@ -1,7 +1,9 @@
import test from "node:test";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import type { Workspace } from "../../types";
import { terminalPaneSessionsEqual } from "../../domain/terminalPaneSessionsEqual.ts";
import {
terminalLayerFocusSidebarPropsEqual,
terminalLayerSidePanelCtxEqual,
@@ -102,6 +104,27 @@ test("terminal layer memo ignores activeWorkspace-only tab flips (live store own
);
});
test("solo tab id change still invalidates workspace ctx; panes host does not read it", () => {
const sessions = [{ id: "session-a" }, { id: "session-b" }];
assert.equal(
terminalLayerWorkspaceCtxEqual(
{ activeTabId: "session-a", sessions },
{ activeTabId: "session-b", sessions },
),
false,
);
const hostSource = readFileSync(new URL("./TerminalLayerSupport.tsx", import.meta.url), "utf8");
const equalStart = hostSource.indexOf("const terminalPanesHostPropsAreEqual");
const equalEnd = hostSource.indexOf("export const TerminalPanesHost");
const equalBody = hostSource.slice(equalStart, equalEnd);
assert.ok(equalStart !== -1 && equalEnd > equalStart);
assert.doesNotMatch(equalBody, /prev\.activeTabId/);
assert.doesNotMatch(equalBody, /next\.activeTabId/);
assert.match(equalBody, /terminalPaneSessionsEqual\(prev\.sessions, next\.sessions\)/);
assert.equal(terminalPaneSessionsEqual(sessions, sessions), true);
});
test("terminal layer memo re-renders when active resizers change", () => {
const base = {
activeResizers: [
@@ -343,6 +343,11 @@ const SIDE_PANEL_STABLE_CTX_KEYS = [
] as const;
const WORKSPACE_CTX_KEYS = [
// Stay. Solo SSH A->B already keeps TerminalPanesHost equal when the sessions
// ref is unchanged (this compare does not feed the panes host). The visible
// pane still pays reveal flush + repaint, and focus retries at 50ms.
// Dropping activeTabId only skips one workspace-section pass; the live-store
// host/theme update still renders the section. That is not the settle cost.
'activeTabId',
'workspaceInnerRef',
'workspaceOuterRef',