mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-16 19:58:03 +01:00
Upgrade avt to the latest version / handle term resize explicitly
This commit is contained in:
4
Cargo.lock
generated
4
Cargo.lock
generated
@@ -180,9 +180,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "avt"
|
name = "avt"
|
||||||
version = "0.14.0"
|
version = "0.15.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b485f400d02970694eed10e7080f994ad82eaf56a867d6671af5d5e184ed8ee6"
|
checksum = "2c72d2ab21480152ba01b79bf3f00197936314b780e21b9ef6f92ee1210c75ce"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rgb",
|
"rgb",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ config = { version = "0.14.0", default-features = false, features = ["toml", "in
|
|||||||
which = "6.0.0"
|
which = "6.0.0"
|
||||||
tempfile = "3.9.0"
|
tempfile = "3.9.0"
|
||||||
scraper = { version = "0.19.0", default-features = false }
|
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"] }
|
axum = { version = "0.7.7", default-features = false, features = ["http1", "ws"] }
|
||||||
tokio = { version = "1.35.1", features = ["full"] }
|
tokio = { version = "1.35.1", features = ["full"] }
|
||||||
futures-util = "0.3.30"
|
futures-util = "0.3.30"
|
||||||
|
|||||||
2
assets/asciinema-player.min.js
vendored
2
assets/asciinema-player.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -15,7 +15,6 @@ impl super::Encoder for TextEncoder {
|
|||||||
fn header(&mut self, header: &Header) -> Vec<u8> {
|
fn header(&mut self, header: &Header) -> Vec<u8> {
|
||||||
let vt = avt::Vt::builder()
|
let vt = avt::Vt::builder()
|
||||||
.size(header.cols as usize, header.rows as usize)
|
.size(header.cols as usize, header.rows as usize)
|
||||||
.resizable(true)
|
|
||||||
.scrollback_limit(100)
|
.scrollback_limit(100)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ impl Session {
|
|||||||
|
|
||||||
pub fn resize(&mut self, time: u64, tty_size: tty::TtySize) {
|
pub fn resize(&mut self, time: u64, tty_size: tty::TtySize) {
|
||||||
if tty_size != self.vt.size().into() {
|
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));
|
let _ = self.broadcast_tx.send(Event::Resize(time, tty_size));
|
||||||
self.stream_time = time;
|
self.stream_time = time;
|
||||||
self.last_event_time = Instant::now();
|
self.last_event_time = Instant::now();
|
||||||
@@ -97,14 +97,9 @@ impl Session {
|
|||||||
fn build_vt(tty_size: tty::TtySize) -> avt::Vt {
|
fn build_vt(tty_size: tty::TtySize) -> avt::Vt {
|
||||||
avt::Vt::builder()
|
avt::Vt::builder()
|
||||||
.size(tty_size.0 as usize, tty_size.1 as usize)
|
.size(tty_size.0 as usize, tty_size.1 as usize)
|
||||||
.resizable(true)
|
|
||||||
.build()
|
.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 {
|
impl Client {
|
||||||
pub fn accept(self, subscription: Subscription) {
|
pub fn accept(self, subscription: Subscription) {
|
||||||
let _ = self.0.send(subscription);
|
let _ = self.0.send(subscription);
|
||||||
|
|||||||
Reference in New Issue
Block a user