I've run into a problem formatting terminal output. I'm using the ansi_term and tabled crates together. Here's a minimal example:
use ansi_term::Style; use tabled::{Table, Tabled}; #[derive(Tabled)] struct Row { column: String, } fn main() { let normal_text = String::from("Normal text"); let italic_text: String = Style::new().italic().paint("Italicised").to_string(); let rows = vec![Row { column: normal_text }, Row { column: italic_text }]; let table = Table::new(rows); println!("{table}"); } Which produces correctly italicized output, but the columns don't line up.
+--------------------+ | column | +--------------------+ | Normal text | +--------------------+ | Italicised | +--------------------+ Any idea what might be happening here?
Thanks again!
1 post - 1 participant
