mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-08 00:19:42 +02:00
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. Changes: - Remove ANSI regex stripping that was breaking terminal output - Send Ctrl+L after resize to trigger Claude CLI to redraw at correct size - Only send Ctrl+L for Claude sessions, not shell sessions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+5
-26
@@ -562,32 +562,13 @@ class ClaudemanApp {
|
|||||||
const res = await fetch(`/api/sessions/${sessionId}/terminal`);
|
const res = await fetch(`/api/sessions/${sessionId}/terminal`);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
// Aggressively clear the terminal before switching sessions
|
|
||||||
// This ensures no residual content from previous display
|
|
||||||
this.terminal.clear();
|
this.terminal.clear();
|
||||||
this.terminal.reset();
|
this.terminal.reset();
|
||||||
|
|
||||||
if (data.terminalBuffer) {
|
if (data.terminalBuffer) {
|
||||||
// Strip leading ANSI escape sequences and whitespace to prevent gaps
|
this.terminal.write(data.terminalBuffer);
|
||||||
// This handles:
|
|
||||||
// - CSI sequences: ESC [ (params) (final) - includes ? for private modes
|
|
||||||
// - OSC sequences: ESC ] ... BEL or ESC \
|
|
||||||
// - Simple sequences: ESC followed by single char
|
|
||||||
// - Whitespace, CR, LF
|
|
||||||
// - Screen initialization sequences
|
|
||||||
let cleanBuffer = data.terminalBuffer;
|
|
||||||
|
|
||||||
// First, strip any leading screen/terminal initialization artifacts
|
|
||||||
// Including cursor positioning that could leave blank space
|
|
||||||
cleanBuffer = cleanBuffer.replace(/^(\x1b\[[0-9;?]*[A-Za-z@`]|\x1b\][^\x07]*\x07|\x1b[()][AB012]|\x1b[=>DEMNOP78c]|\x1b[^\x1b]|\s|\r|\n)*/g, '');
|
|
||||||
|
|
||||||
// Also strip any DCS sequences (screen might send these)
|
|
||||||
cleanBuffer = cleanBuffer.replace(/^\x1bP[^\x1b]*\x1b\\/g, '');
|
|
||||||
|
|
||||||
this.terminal.write(cleanBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send resize and trigger redraw
|
// Send resize and Ctrl+L to trigger Claude to redraw at correct size
|
||||||
const dims = this.fitAddon.proposeDimensions();
|
const dims = this.fitAddon.proposeDimensions();
|
||||||
if (dims) {
|
if (dims) {
|
||||||
await fetch(`/api/sessions/${sessionId}/resize`, {
|
await fetch(`/api/sessions/${sessionId}/resize`, {
|
||||||
@@ -595,15 +576,13 @@ class ClaudemanApp {
|
|||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ cols: dims.cols, rows: dims.rows })
|
body: JSON.stringify({ cols: dims.cols, rows: dims.rows })
|
||||||
});
|
});
|
||||||
|
// Send Ctrl+L to fix squished display after tab switch
|
||||||
// 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);
|
const session = this.sessions.get(sessionId);
|
||||||
if (session && session.mode !== 'shell') {
|
if (session && session.mode !== 'shell') {
|
||||||
await fetch(`/api/sessions/${sessionId}/input`, {
|
fetch(`/api/sessions/${sessionId}/input`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ input: '\x0c' }) // Ctrl+L
|
body: JSON.stringify({ input: '\x0c' })
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user