fix(terminal): Claude panes scroll 5 lines per wheel notch

Fullscreen Claude Code scrolls one line per wheel report when its terminal
does not answer XTVERSION as xterm.js (behind tmux it never does), and
xterm.js sends one report per notch — so a notch moved a single line.
spawnRun now sets CLAUDE_CODE_SCROLL_SPEED=5 unless the dashboard's env
already sets it; settings.json env and /config Scroll speed still win.
This commit is contained in:
2026-11-02 15:32:46 +07:00
parent 68c3cfaf26
commit faa96d1964
3 changed files with 15 additions and 1 deletions
+3
View File
@@ -208,6 +208,9 @@ describe("lane-sources instructions and launch", () => {
// Claude Code hides its task tools from newer models without this, and the
// chat Progress panel is drawn from those calls.
assert.ok(newSession.includes("CLAUDE_CODE_ENABLE_TODO_TOOLS=1"));
// One wheel notch reaches claude as one report; it scrolls this many lines.
if (!process.env.CLAUDE_CODE_SCROLL_SPEED)
assert.ok(newSession.includes("CLAUDE_CODE_SCROLL_SPEED=5"));
assert.deepEqual(fs.readdirSync(dir), ["CLAUDE.md"]);
const text = fs.readFileSync(path.join(dir, "CLAUDE.md"), "utf8");
assert.match(text, /^- always answer in Vietnamese/);
+11
View File
@@ -49,6 +49,8 @@ const RUN_ID_RE = /^agenthub-lane-(\d+)(?:-([1-9]))?$/;
/** Highest pane slot a lane may use: ten sessions per workspace, 0–9 (the
* Workspace groups them into tabs of up to four split panes each). */
const MAX_PANE_SLOT = 9;
// Lines a fullscreen `claude` scrolls per wheel report (see spawnRun's env).
const CLAUDE_SCROLL_SPEED = "5";
const EFFORT_LEVELS = new Set(["low", "medium", "high", "xhigh", "max"]);
// `auto` is the CLI's own default-ish mode (`claude --permission-mode auto`):
// it asks only for what its classifier reads as risky. `default` is kept for
@@ -663,6 +665,15 @@ function spawnRun(args) {
// (routes/sessions.js sessionOutline). A user's settings.json `env` still
// wins, so `"0"` there turns them back off.
...(entry.launcher === "claude" ? { CLAUDE_CODE_ENABLE_TODO_TOOLS: "1" } : {}),
// Fullscreen claude scrolls by itself, and through tmux it cannot tell it
// runs in xterm.js (XTVERSION answers tmux), so it takes ONE line per wheel
// report — while xterm.js sends one report per notch (and damps a trackpad
// ×0.3). A notch moved a single line. CLAUDE_CODE_SCROLL_SPEED is Claude's
// own multiplier; the dashboard's env or the user's settings.json `env`
// (or /config → Scroll speed) still wins.
...(entry.launcher === "claude" && !process.env.CLAUDE_CODE_SCROLL_SPEED
? { CLAUDE_CODE_SCROLL_SPEED: CLAUDE_SCROLL_SPEED }
: {}),
// No CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN: an inline claude duplicated its
// output whenever the pane narrowed (tmux re-wraps the full-width rules and
// pushes lines into history its redraw cannot clear). The user's own