mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-09-30 20:49:41 +02:00
fix: scroll terminal to bottom on tab switch
After loading the terminal buffer on tab switch, xterm.js wasn't guaranteed to be scrolled to the bottom, requiring users to manually scroll down. Fix by: 1. Adding scrollToBottom() after chunkedTerminalWrite completes 2. Adding scrollToBottom() after terminal.focus() 3. Delaying chunkedTerminalWrite resolution by one extra rAF to ensure xterm.js has finished rendering the final chunk Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -231,7 +231,8 @@ class ClaudemanApp {
|
||||
let offset = 0;
|
||||
const writeChunk = () => {
|
||||
if (offset >= buffer.length) {
|
||||
resolve();
|
||||
// Wait one more frame for xterm to finish rendering before resolving
|
||||
requestAnimationFrame(() => resolve());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -845,6 +846,8 @@ class ClaudemanApp {
|
||||
}
|
||||
// Use chunked write for large buffers to avoid UI jank
|
||||
await this.chunkedTerminalWrite(data.terminalBuffer);
|
||||
// Ensure terminal is scrolled to bottom after buffer load
|
||||
this.terminal.scrollToBottom();
|
||||
}
|
||||
|
||||
// Send resize and Ctrl+L to trigger Claude to redraw at correct size
|
||||
@@ -883,6 +886,7 @@ class ClaudemanApp {
|
||||
this.renderRalphStatePanel();
|
||||
|
||||
this.terminal.focus();
|
||||
this.terminal.scrollToBottom();
|
||||
} catch (err) {
|
||||
console.error('Failed to load session terminal:', err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user