diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-11-20 03:35:29 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-11-20 03:35:29 -0500 |
commit | 8841984e10d4101545ebb9d9cff35f558791de06 (patch) | |
tree | 16efbe5f292d1467a3e320e63938174b96e0f46e | |
parent | 07f8c1715a4e900272de901303ef6a4e28ce4dfa (diff) | |
download | vt100-test-8841984e10d4101545ebb9d9cff35f558791de06.tar.gz vt100-test-8841984e10d4101545ebb9d9cff35f558791de06.zip |
also display text width
-rw-r--r-- | Cargo.lock | 1 | ||||
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | src/bin/explode.rs | 3 |
3 files changed, 4 insertions, 1 deletions
@@ -917,6 +917,7 @@ dependencies = [ "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-pty-process-stream 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "ttyrec 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "vt100 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "vte 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -12,5 +12,6 @@ mio = "0.6" tokio = "0.1.22" tokio-pty-process-stream = "0.2" ttyrec = "0.2" +unicode-width = "0.1" vt100 = "0.6" vte = "0.3" diff --git a/src/bin/explode.rs b/src/bin/explode.rs index 37ed07c..d23a59b 100644 --- a/src/bin/explode.rs +++ b/src/bin/explode.rs @@ -1,4 +1,5 @@ use std::io::Read as _; +use unicode_width::UnicodeWidthStr as _; #[derive(Default)] struct Printer { @@ -12,7 +13,7 @@ impl Printer { fn flush(&mut self) { if !self.chars.is_empty() { - println!("TEXT \"{}\"", self.chars); + println!("TEXT({}) \"{}\"", self.chars.width(), self.chars); self.chars.clear(); } } |