Upgrade avt to the latest version / handle term resize explicitly

This commit is contained in:
Marcin Kulik
2025-01-11 11:34:01 +01:00
parent db956df97f
commit 7f9837e30f
5 changed files with 5 additions and 11 deletions

4
Cargo.lock generated
View File

@@ -180,9 +180,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "avt"
version = "0.14.0"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b485f400d02970694eed10e7080f994ad82eaf56a867d6671af5d5e184ed8ee6"
checksum = "2c72d2ab21480152ba01b79bf3f00197936314b780e21b9ef6f92ee1210c75ce"
dependencies = [
"rgb",
"unicode-width",

View File

@@ -28,7 +28,7 @@ config = { version = "0.14.0", default-features = false, features = ["toml", "in
which = "6.0.0"
tempfile = "3.9.0"
scraper = { version = "0.19.0", default-features = false }
avt = "0.14.0"
avt = "0.15.0"
axum = { version = "0.7.7", default-features = false, features = ["http1", "ws"] }
tokio = { version = "1.35.1", features = ["full"] }
futures-util = "0.3.30"

File diff suppressed because one or more lines are too long

View File

@@ -15,7 +15,6 @@ impl super::Encoder for TextEncoder {
fn header(&mut self, header: &Header) -> Vec<u8> {
let vt = avt::Vt::builder()
.size(header.cols as usize, header.rows as usize)
.resizable(true)
.scrollback_limit(100)
.build();

View File

@@ -65,7 +65,7 @@ impl Session {
pub fn resize(&mut self, time: u64, tty_size: tty::TtySize) {
if tty_size != self.vt.size().into() {
resize_vt(&mut self.vt, &tty_size);
self.vt.resize(tty_size.0.into(), tty_size.1.into());
let _ = self.broadcast_tx.send(Event::Resize(time, tty_size));
self.stream_time = time;
self.last_event_time = Instant::now();
@@ -97,14 +97,9 @@ impl Session {
fn build_vt(tty_size: tty::TtySize) -> avt::Vt {
avt::Vt::builder()
.size(tty_size.0 as usize, tty_size.1 as usize)
.resizable(true)
.build()
}
fn resize_vt(vt: &mut avt::Vt, tty_size: &tty::TtySize) {
vt.feed_str(&format!("\x1b[8;{};{}t", tty_size.1, tty_size.0));
}
impl Client {
pub fn accept(self, subscription: Subscription) {
let _ = self.0.send(subscription);