fix: Improve terminal buffer handling and replay performance

- Add chunked replay (8KB chunks with 10ms delay) to avoid overwhelming xterm.js
- Add clear-buffer server command to reset terminal history
- Add clear buffer button in terminal header
- Filter out tiny resize events during CSS transitions (ignore < 20x5)
- Remove premature fit() call from init - wait for onBecameVisible
This commit is contained in:
2026-02-14 12:57:30 -06:00
parent 88a76c005d
commit 2a01574d00
3 changed files with 55 additions and 8 deletions

View File

@@ -187,6 +187,10 @@ export function startTerminalServer() {
} else if (msg.type === 'resize' && msg.cols && msg.rows) {
session.pty.resize(msg.cols, msg.rows)
console.log(`[Terminal] Session ${sessionId} resized to ${msg.cols}x${msg.rows}`)
} else if (msg.type === 'clear-buffer') {
session.outputBuffer = []
console.log(`[Terminal] Buffer cleared for session ${sessionId}`)
ws.send(JSON.stringify({ type: 'buffer-cleared' }))
} else if (msg.type === 'request-replay') {
// Client requests fresh replay (used when terminal becomes visible)
console.log(`[Terminal] Replay requested, buffer has ${session.outputBuffer.length} chunks`)