fix: keep terminal viewport compact and isolate key events

This commit is contained in:
archipelago
2026-10-09 12:37:32 -04:00
parent 339243e861
commit 2ed45b1094
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -239,7 +239,11 @@ pub(crate) async fn websocket(req: Request<hyper::Body>) -> Result<Response<hype
loop {
tokio::select! {
_ = interval.tick() => {
let output = Command::new("tmux").args(["capture-pane", "-p", "-e", "-t", &record.tmux, "-S", "-250"]).output().await;
// Capture the visible pane only. Asking tmux for a large
// historical range injects hundreds of blank rows into
// xterm on every reconnect, producing a misleading
// giant initial scrollbar. xterm owns live scrollback.
let output = Command::new("tmux").args(["capture-pane", "-p", "-e", "-t", &record.tmux]).output().await;
if let Ok(output) = output {
let text = String::from_utf8_lossy(&output.stdout).into_owned();
if text != last { last = text.clone(); if tx.send(Message::Text(serde_json::json!({"type":"output", "data":text}).to_string())).await.is_err() { break; } }