fix: send Ctrl+L after tab switch to fix squished Claude display

When switching between Claude session tabs, the terminal buffer was
rendered at a different size than the current terminal. This caused
Claude's banner to appear squished/corrupted. Sending Ctrl+L after
resize triggers Claude CLI to redraw at the correct dimensions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-19 07:35:55 +01:00
co-authored by Claude Opus 4.5
parent 2cf3d66d0f
commit 5d1c60fd1a
+13 -2
View File
@@ -587,14 +587,25 @@ class ClaudemanApp {
this.terminal.write(cleanBuffer);
}
// Send resize
// Send resize and trigger redraw
const dims = this.fitAddon.proposeDimensions();
if (dims) {
fetch(`/api/sessions/${sessionId}/resize`, {
await fetch(`/api/sessions/${sessionId}/resize`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ cols: dims.cols, rows: dims.rows })
});
// Send Ctrl+L to trigger Claude CLI to redraw at the new size
// This fixes the "squished" display when switching between tabs
const session = this.sessions.get(sessionId);
if (session && session.mode !== 'shell') {
await fetch(`/api/sessions/${sessionId}/input`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ input: '\x0c' }) // Ctrl+L
});
}
}
// Update respawn banner