replace tui with ratatui

This commit is contained in:
Marcel Märtens 2024-02-06 16:06:58 +01:00
parent 9af1c4c310
commit be6a99acb4
5 changed files with 137 additions and 175 deletions

257
Cargo.lock generated
View File

@ -692,6 +692,15 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
[[package]]
name = "castaway"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a17ed5635fc8536268e5d4de1e22e81ac34419e5f052d4d51f4e01dcc263fcc"
dependencies = [
"rustversion",
]
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.83" version = "1.0.83"
@ -921,15 +930,6 @@ dependencies = [
"x11rb 0.13.0", "x11rb 0.13.0",
] ]
[[package]]
name = "cloudabi"
version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
dependencies = [
"bitflags 1.3.2",
]
[[package]] [[package]]
name = "cmake" name = "cmake"
version = "0.1.45" version = "0.1.45"
@ -1007,6 +1007,19 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "compact_str"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f"
dependencies = [
"castaway",
"cfg-if 1.0.0",
"itoa",
"ryu",
"static_assertions",
]
[[package]] [[package]]
name = "concurrent-queue" name = "concurrent-queue"
version = "2.4.0" version = "2.4.0"
@ -1393,22 +1406,6 @@ version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
[[package]]
name = "crossterm"
version = "0.17.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f4919d60f26ae233e14233cc39746c8c8bb8cd7b05840ace83604917b51b6c7"
dependencies = [
"bitflags 1.3.2",
"crossterm_winapi 0.6.2",
"lazy_static",
"libc",
"mio 0.7.14",
"parking_lot 0.10.2",
"signal-hook 0.1.17",
"winapi",
]
[[package]] [[package]]
name = "crossterm" name = "crossterm"
version = "0.26.1" version = "0.26.1"
@ -1416,21 +1413,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13" checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"crossterm_winapi 0.9.1", "crossterm_winapi",
"libc", "libc",
"mio 0.8.10", "mio",
"parking_lot 0.12.1", "parking_lot 0.12.1",
"signal-hook 0.3.17", "signal-hook",
"signal-hook-mio", "signal-hook-mio",
"winapi", "winapi",
] ]
[[package]] [[package]]
name = "crossterm_winapi" name = "crossterm"
version = "0.6.2" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2265c3f8e080075d9b6417aa72293fc71662f34b4af2612d8d1b074d29510db" checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df"
dependencies = [ dependencies = [
"bitflags 2.4.2",
"crossterm_winapi",
"libc",
"mio",
"parking_lot 0.12.1",
"signal-hook",
"signal-hook-mio",
"winapi", "winapi",
] ]
@ -1583,7 +1587,7 @@ checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"hashbrown 0.14.3", "hashbrown 0.14.3",
"lock_api 0.4.11", "lock_api",
"once_cell", "once_cell",
"parking_lot_core 0.9.9", "parking_lot_core 0.9.9",
] ]
@ -2963,6 +2967,12 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "indoc"
version = "2.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8"
[[package]] [[package]]
name = "inline_tweak" name = "inline_tweak"
version = "1.1.1" version = "1.1.1"
@ -3335,15 +3345,6 @@ version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
[[package]]
name = "lock_api"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"
dependencies = [
"scopeguard",
]
[[package]] [[package]]
name = "lock_api" name = "lock_api"
version = "0.4.11" version = "0.4.11"
@ -3373,6 +3374,15 @@ dependencies = [
"tracing-subscriber", "tracing-subscriber",
] ]
[[package]]
name = "lru"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db2c024b41519440580066ba82aab04092b333e09066a5eb86c7c4890df31f22"
dependencies = [
"hashbrown 0.14.3",
]
[[package]] [[package]]
name = "lz-fear" name = "lz-fear"
version = "0.1.1" version = "0.1.1"
@ -3573,19 +3583,6 @@ dependencies = [
"simd-adler32", "simd-adler32",
] ]
[[package]]
name = "mio"
version = "0.7.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc"
dependencies = [
"libc",
"log",
"miow",
"ntapi",
"winapi",
]
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.8.10" version = "0.8.10"
@ -3598,15 +3595,6 @@ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
[[package]]
name = "miow"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "more-asserts" name = "more-asserts"
version = "0.2.2" version = "0.2.2"
@ -3863,7 +3851,7 @@ dependencies = [
"kqueue", "kqueue",
"libc", "libc",
"log", "log",
"mio 0.8.10", "mio",
"walkdir", "walkdir",
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
@ -3889,14 +3877,6 @@ dependencies = [
"syn 1.0.109", "syn 1.0.109",
] ]
[[package]]
name = "ntapi"
version = "0.3.7"
source = "git+https://github.com/MSxDOS/ntapi.git?rev=9f56b149c9e25796739157c0fce3e0007a7de6eb#9f56b149c9e25796739157c0fce3e0007a7de6eb"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "nu-ansi-term" name = "nu-ansi-term"
version = "0.46.0" version = "0.46.0"
@ -4305,16 +4285,6 @@ dependencies = [
"num-traits", "num-traits",
] ]
[[package]]
name = "parking_lot"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
dependencies = [
"lock_api 0.3.4",
"parking_lot_core 0.7.3",
]
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.11.2" version = "0.11.2"
@ -4322,7 +4292,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [ dependencies = [
"instant", "instant",
"lock_api 0.4.11", "lock_api",
"parking_lot_core 0.8.6", "parking_lot_core 0.8.6",
] ]
@ -4332,24 +4302,10 @@ version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [ dependencies = [
"lock_api 0.4.11", "lock_api",
"parking_lot_core 0.9.9", "parking_lot_core 0.9.9",
] ]
[[package]]
name = "parking_lot_core"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b93f386bb233083c799e6e642a9d73db98c24a5deeb95ffc85bf281255dffc98"
dependencies = [
"cfg-if 0.1.10",
"cloudabi",
"libc",
"redox_syscall 0.1.57",
"smallvec",
"winapi",
]
[[package]] [[package]]
name = "parking_lot_core" name = "parking_lot_core"
version = "0.8.6" version = "0.8.6"
@ -4905,6 +4861,26 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab" checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab"
[[package]]
name = "ratatui"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "154b85ef15a5d1719bcaa193c3c81fe645cd120c156874cd660fe49fd21d1373"
dependencies = [
"bitflags 2.4.2",
"cassowary",
"compact_str",
"crossterm 0.27.0",
"indoc",
"itertools 0.12.1",
"lru",
"paste",
"stability",
"strum 0.26.1",
"unicode-segmentation",
"unicode-width",
]
[[package]] [[package]]
name = "raw-window-handle" name = "raw-window-handle"
version = "0.4.3" version = "0.4.3"
@ -4952,12 +4928,6 @@ dependencies = [
"yasna", "yasna",
] ]
[[package]]
name = "redox_syscall"
version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.2.16" version = "0.2.16"
@ -5763,17 +5733,6 @@ version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5ea33232fdcf1bf691ca33450e5a94dde13e1a8cbb8caabc5e4f9d761e10b1a" checksum = "a5ea33232fdcf1bf691ca33450e5a94dde13e1a8cbb8caabc5e4f9d761e10b1a"
[[package]]
name = "signal-hook"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e31d442c16f047a671b5a71e2161d6e68814012b7f5379d269ebd915fac2729"
dependencies = [
"libc",
"mio 0.7.14",
"signal-hook-registry",
]
[[package]] [[package]]
name = "signal-hook" name = "signal-hook"
version = "0.3.17" version = "0.3.17"
@ -5791,8 +5750,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af"
dependencies = [ dependencies = [
"libc", "libc",
"mio 0.8.10", "mio",
"signal-hook 0.3.17", "signal-hook",
] ]
[[package]] [[package]]
@ -5940,7 +5899,7 @@ version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
dependencies = [ dependencies = [
"lock_api 0.4.11", "lock_api",
] ]
[[package]] [[package]]
@ -5962,6 +5921,16 @@ dependencies = [
"num-traits", "num-traits",
] ]
[[package]]
name = "stability"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebd1b177894da2a2d9120208c3386066af06a488255caabc5de8ddca22dbc3ce"
dependencies = [
"quote 1.0.35",
"syn 1.0.109",
]
[[package]] [[package]]
name = "stable_deref_trait" name = "stable_deref_trait"
version = "1.2.0" version = "1.2.0"
@ -6084,7 +6053,16 @@ version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f"
dependencies = [ dependencies = [
"strum_macros", "strum_macros 0.24.3",
]
[[package]]
name = "strum"
version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "723b93e8addf9aa965ebe2d11da6d7540fa2283fcea14b3371ff055f7ba13f5f"
dependencies = [
"strum_macros 0.26.1",
] ]
[[package]] [[package]]
@ -6100,6 +6078,19 @@ dependencies = [
"syn 1.0.109", "syn 1.0.109",
] ]
[[package]]
name = "strum_macros"
version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a3417fc93d76740d974a01654a09777cb500428cc874ca9f45edfe0c4d4cd18"
dependencies = [
"heck 0.4.1",
"proc-macro2 1.0.78",
"quote 1.0.35",
"rustversion",
"syn 2.0.48",
]
[[package]] [[package]]
name = "sum_type" name = "sum_type"
version = "0.2.0" version = "0.2.0"
@ -6380,7 +6371,7 @@ dependencies = [
"backtrace", "backtrace",
"bytes", "bytes",
"libc", "libc",
"mio 0.8.10", "mio",
"num_cpus", "num_cpus",
"pin-project-lite", "pin-project-lite",
"signal-hook-registry", "signal-hook-registry",
@ -6659,18 +6650,6 @@ version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4"
[[package]]
name = "tui"
version = "0.10.0"
source = "git+https://github.com/fdehau/tui-rs.git?branch=paragraph-scroll#54b841fab6cfdb38e8dc1382176e965787964b4c"
dependencies = [
"bitflags 1.3.2",
"cassowary",
"crossterm 0.17.7",
"unicode-segmentation",
"unicode-width",
]
[[package]] [[package]]
name = "tuple_utils" name = "tuple_utils"
version = "0.4.0" version = "0.4.0"
@ -6954,7 +6933,7 @@ dependencies = [
"slotmap", "slotmap",
"specs", "specs",
"spin_sleep", "spin_sleep",
"strum", "strum 0.24.1",
"tracing", "tracing",
"tracing-subscriber", "tracing-subscriber",
"uuid", "uuid",
@ -7222,7 +7201,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"specs", "specs",
"strum", "strum 0.24.1",
"tokio", "tokio",
"tracing", "tracing",
"vek 0.15.8", "vek 0.15.8",
@ -7267,13 +7246,13 @@ dependencies = [
"mimalloc", "mimalloc",
"num_cpus", "num_cpus",
"prometheus", "prometheus",
"ratatui",
"ron", "ron",
"serde", "serde",
"shell-words", "shell-words",
"signal-hook 0.3.17", "signal-hook",
"tokio", "tokio",
"tracing", "tracing",
"tui",
"veloren-common", "veloren-common",
"veloren-common-base", "veloren-common-base",
"veloren-common-frontend", "veloren-common-frontend",
@ -7335,7 +7314,7 @@ dependencies = [
"shaderc", "shaderc",
"slab", "slab",
"specs", "specs",
"strum", "strum 0.24.1",
"tokio", "tokio",
"tracing", "tracing",
"treeculler", "treeculler",
@ -7431,7 +7410,7 @@ dependencies = [
"rstar", "rstar",
"rusqlite", "rusqlite",
"serde", "serde",
"strum", "strum 0.24.1",
"svg_fmt", "svg_fmt",
"tracing", "tracing",
"tracing-subscriber", "tracing-subscriber",
@ -8418,7 +8397,7 @@ dependencies = [
"instant", "instant",
"libc", "libc",
"log", "log",
"mio 0.8.10", "mio",
"ndk 0.7.0", "ndk 0.7.0",
"objc2", "objc2",
"once_cell", "once_cell",

View File

@ -159,8 +159,6 @@ clap = { version = "4.2", features = ["derive"]}
[patch.crates-io] [patch.crates-io]
vek = { git = "https://github.com/yoanlcq/vek.git", rev = "84d5cb65841d46599a986c5477341bea4456be26" } vek = { git = "https://github.com/yoanlcq/vek.git", rev = "84d5cb65841d46599a986c5477341bea4456be26" }
# ntapi 3.7 fails to compile under windows due to the bug https://github.com/MSxDOS/ntapi/pull/12
ntapi = { git = "https://github.com/MSxDOS/ntapi.git", rev = "9f56b149c9e25796739157c0fce3e0007a7de6eb" }
shred = { git = "https://github.com/amethyst/shred.git", rev = "5d52c6fc390dd04c12158633e77591f6523d1f85" } shred = { git = "https://github.com/amethyst/shred.git", rev = "5d52c6fc390dd04c12158633e77591f6523d1f85" }
# This is needed because of an issue with spirv & naga in wgpu 0.18, and there's an issue # This is needed because of an issue with spirv & naga in wgpu 0.18, and there's an issue
# with uint in uniforms for gl. # with uint in uniforms for gl.

View File

@ -46,6 +46,7 @@ shell-words = "1.0.0"
tracing = { workspace = true } tracing = { workspace = true }
ron = { workspace = true } ron = { workspace = true }
serde = { workspace = true, features = [ "rc", "derive" ]} serde = { workspace = true, features = [ "rc", "derive" ]}
ratatui = { version = "0.26.0", features = ["crossterm"] }
#HTTP #HTTP
axum = { version = "0.6.20" } axum = { version = "0.6.20" }
@ -55,9 +56,3 @@ chrono = { workspace = true }
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
mimalloc = "0.1.29" mimalloc = "0.1.29"
[dependencies.tui]
git = "https://github.com/fdehau/tui-rs.git"
branch="paragraph-scroll"
default-features = false
features = ['crossterm']

View File

@ -4,6 +4,13 @@ use crossterm::{
execute, execute,
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}, terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
}; };
use ratatui::{
backend::CrosstermBackend,
layout::Rect,
text::Text,
widgets::{Block, Borders, Paragraph},
Terminal,
};
use std::{ use std::{
io, io,
sync::{ sync::{
@ -13,13 +20,6 @@ use std::{
time::Duration, time::Duration,
}; };
use tracing::{debug, error, warn}; use tracing::{debug, error, warn};
use tui::{
backend::CrosstermBackend,
layout::Rect,
text::Text,
widgets::{Block, Borders, Paragraph, Wrap},
Terminal,
};
pub struct Tui { pub struct Tui {
pub msg_r: mpsc::Receiver<Message>, pub msg_r: mpsc::Receiver<Message>,
@ -140,18 +140,8 @@ impl Tui {
let block = Block::default().borders(Borders::ALL); let block = Block::default().borders(Borders::ALL);
let wrap = Wrap { LOG.resize(log_rect.height as usize);
scroll_callback: Some(Box::new(|text_area, lines| { let logger = Paragraph::new(LOG.inner.lock().unwrap().clone()).block(block);
LOG.resize(text_area.height as usize);
let len = lines.len() as u16;
(len.saturating_sub(text_area.height), 0)
})),
..Default::default()
};
let logger = Paragraph::new(LOG.inner.lock().unwrap().clone())
.block(block)
.wrap(wrap);
f.render_widget(logger, log_rect); f.render_widget(logger, log_rect);
let text: Text = input.as_str().into(); let text: Text = input.as_str().into();

View File

@ -1,9 +1,13 @@
use ratatui::{
prelude::Line,
style::{Color, Modifier, Style},
text::{Span, Text},
};
use std::{ use std::{
io::{self, Write}, io::{self, Write},
sync::{Arc, Mutex}, sync::{Arc, Mutex},
}; };
use tracing::warn; use tracing::warn;
use tui::text::Text;
#[derive(Debug, Default, Clone)] #[derive(Debug, Default, Clone)]
pub struct TuiLog<'a> { pub struct TuiLog<'a> {
@ -29,10 +33,6 @@ impl<'a> Write for TuiLog<'a> {
// depend on an old version of nom. Alternatives to consider may include // depend on an old version of nom. Alternatives to consider may include
// `vte`, `anstyle-parse`, `vt100`, or others. // `vte`, `anstyle-parse`, `vt100`, or others.
use cansi::v3::categorise_text; use cansi::v3::categorise_text;
use tui::{
style::{Color, Modifier},
text::{Span, Spans},
};
let line = let line =
core::str::from_utf8(buf).map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?; core::str::from_utf8(buf).map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
@ -41,7 +41,7 @@ impl<'a> Write for TuiLog<'a> {
let mut lines = Vec::new(); let mut lines = Vec::new();
for out in categorise_text(line) { for out in categorise_text(line) {
let mut style = tui::style::Style::default(); let mut style = Style::default();
// NOTE: There are other values returned from cansi that we don't bother to use // NOTE: There are other values returned from cansi that we don't bother to use
// for now including background color, italics, blinking, etc. // for now including background color, italics, blinking, etc.
style.fg = match out.fg { style.fg = match out.fg {
@ -72,12 +72,12 @@ impl<'a> Write for TuiLog<'a> {
spans.push(Span::styled(t.to_owned(), style)); spans.push(Span::styled(t.to_owned(), style));
} }
if t.ends_with('\n') { if t.ends_with('\n') {
lines.push(Spans(core::mem::take(&mut spans))); lines.push(Line::from(core::mem::take(&mut spans)));
} }
} }
} }
if !spans.is_empty() { if !spans.is_empty() {
lines.push(Spans(spans)); lines.push(Line::from(spans));
} }
self.inner.lock().unwrap().lines.append(&mut lines); self.inner.lock().unwrap().lines.append(&mut lines);