Commit 95af00ba93
Unregistered key
Layout: unified · split
Cargo.lock +58 −28
| @@ -687,27 +687,11 @@ dependencies = [ | ||
| 687 | 687 | |
| 688 | 688 | [[package]] |
| 689 | 689 | name = "crossterm" |
| 690 | version = "0.25.0" | |
| 691 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 692 | checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" | |
| 693 | dependencies = [ | |
| 694 | "bitflags 1.3.2", | |
| 695 | "crossterm_winapi", | |
| 696 | "libc", | |
| 697 | "mio", | |
| 698 | "parking_lot 0.12.1", | |
| 699 | "signal-hook", | |
| 700 | "signal-hook-mio", | |
| 701 | "winapi", | |
| 702 | ] | |
| 703 | ||
| 704 | [[package]] | |
| 705 | name = "crossterm" | |
| 706 | version = "0.26.1" | |
| 690 | version = "0.27.0" | |
| 707 | 691 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 708 | checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13" | |
| 692 | checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" | |
| 709 | 693 | dependencies = [ |
| 710 | "bitflags 1.3.2", | |
| 694 | "bitflags 2.4.0", | |
| 711 | 695 | "crossterm_winapi", |
| 712 | 696 | "libc", |
| 713 | 697 | "mio", |
| @@ -1564,7 +1548,7 @@ name = "iamb" | ||
| 1564 | 1548 | version = "0.0.9-alpha.1" |
| 1565 | 1549 | dependencies = [ |
| 1566 | 1550 | "arboard", |
| 1567 | "bitflags 1.3.2", | |
| 1551 | "bitflags 2.4.0", | |
| 1568 | 1552 | "chrono", |
| 1569 | 1553 | "clap", |
| 1570 | 1554 | "comrak", |
| @@ -1694,6 +1678,12 @@ dependencies = [ | ||
| 1694 | 1678 | "hashbrown 0.14.1", |
| 1695 | 1679 | ] |
| 1696 | 1680 | |
| 1681 | [[package]] | |
| 1682 | name = "indoc" | |
| 1683 | version = "2.0.4" | |
| 1684 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 1685 | checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" | |
| 1686 | ||
| 1697 | 1687 | [[package]] |
| 1698 | 1688 | name = "inout" |
| 1699 | 1689 | version = "0.1.3" |
| @@ -1762,6 +1752,15 @@ dependencies = [ | ||
| 1762 | 1752 | "either", |
| 1763 | 1753 | ] |
| 1764 | 1754 | |
| 1755 | [[package]] | |
| 1756 | name = "itertools" | |
| 1757 | version = "0.11.0" | |
| 1758 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 1759 | checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" | |
| 1760 | dependencies = [ | |
| 1761 | "either", | |
| 1762 | ] | |
| 1763 | ||
| 1765 | 1764 | [[package]] |
| 1766 | 1765 | name = "itoa" |
| 1767 | 1766 | version = "1.0.9" |
| @@ -2187,13 +2186,12 @@ dependencies = [ | ||
| 2187 | 2186 | [[package]] |
| 2188 | 2187 | name = "modalkit" |
| 2189 | 2188 | version = "0.0.16" |
| 2190 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 2191 | checksum = "3f38eef0b4f6377e73d1082d508cae1df4d99a94d25361538131d839f292aa49" | |
| 2189 | source = "git+https://github.com/ulyssa/modalkit?rev=f9f0517ed6a6152c1eab36d2e71b11f38831d5e6#f9f0517ed6a6152c1eab36d2e71b11f38831d5e6" | |
| 2192 | 2190 | dependencies = [ |
| 2193 | 2191 | "anymap2", |
| 2194 | 2192 | "arboard", |
| 2195 | 2193 | "bitflags 1.3.2", |
| 2196 | "crossterm 0.25.0", | |
| 2194 | "crossterm", | |
| 2197 | 2195 | "derive_more", |
| 2198 | 2196 | "intervaltree", |
| 2199 | 2197 | "libc", |
| @@ -2452,6 +2450,12 @@ dependencies = [ | ||
| 2452 | 2450 | "subtle", |
| 2453 | 2451 | ] |
| 2454 | 2452 | |
| 2453 | [[package]] | |
| 2454 | name = "paste" | |
| 2455 | version = "1.0.14" | |
| 2456 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 2457 | checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" | |
| 2458 | ||
| 2455 | 2459 | [[package]] |
| 2456 | 2460 | name = "pathdiff" |
| 2457 | 2461 | version = "0.2.1" |
| @@ -2676,7 +2680,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 2676 | 2680 | checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" |
| 2677 | 2681 | dependencies = [ |
| 2678 | 2682 | "anyhow", |
| 2679 | "itertools", | |
| 2683 | "itertools 0.10.5", | |
| 2680 | 2684 | "proc-macro2", |
| 2681 | 2685 | "quote", |
| 2682 | 2686 | "syn 1.0.109", |
| @@ -2804,13 +2808,17 @@ dependencies = [ | ||
| 2804 | 2808 | |
| 2805 | 2809 | [[package]] |
| 2806 | 2810 | name = "ratatui" |
| 2807 | version = "0.20.1" | |
| 2811 | version = "0.23.0" | |
| 2808 | 2812 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 2809 | checksum = "dcc0d032bccba900ee32151ec0265667535c230169f5a011154cdcd984e16829" | |
| 2813 | checksum = "2e2e4cd95294a85c3b4446e63ef054eea43e0205b1fd60120c16b74ff7ff96ad" | |
| 2810 | 2814 | dependencies = [ |
| 2811 | "bitflags 1.3.2", | |
| 2815 | "bitflags 2.4.0", | |
| 2812 | 2816 | "cassowary", |
| 2813 | "crossterm 0.26.1", | |
| 2817 | "crossterm", | |
| 2818 | "indoc", | |
| 2819 | "itertools 0.11.0", | |
| 2820 | "paste", | |
| 2821 | "strum", | |
| 2814 | 2822 | "unicode-segmentation", |
| 2815 | 2823 | "unicode-width", |
| 2816 | 2824 | ] |
| @@ -3473,6 +3481,28 @@ version = "0.10.0" | ||
| 3473 | 3481 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3474 | 3482 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" |
| 3475 | 3483 | |
| 3484 | [[package]] | |
| 3485 | name = "strum" | |
| 3486 | version = "0.25.0" | |
| 3487 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 3488 | checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" | |
| 3489 | dependencies = [ | |
| 3490 | "strum_macros", | |
| 3491 | ] | |
| 3492 | ||
| 3493 | [[package]] | |
| 3494 | name = "strum_macros" | |
| 3495 | version = "0.25.2" | |
| 3496 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 3497 | checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059" | |
| 3498 | dependencies = [ | |
| 3499 | "heck", | |
| 3500 | "proc-macro2", | |
| 3501 | "quote", | |
| 3502 | "rustversion", | |
| 3503 | "syn 2.0.38", | |
| 3504 | ] | |
| 3505 | ||
| 3476 | 3506 | [[package]] |
| 3477 | 3507 | name = "subtle" |
| 3478 | 3508 | version = "2.5.0" |
Cargo.toml +4 −2
| @@ -24,7 +24,7 @@ features = ["build", "git", "gitcl",] | ||
| 24 | 24 | |
| 25 | 25 | [dependencies] |
| 26 | 26 | arboard = "3.2.0" |
| 27 | bitflags = "1.3.2" | |
| 27 | bitflags = "^2.3" | |
| 28 | 28 | chrono = "0.4" |
| 29 | 29 | clap = {version = "~4.3", features = ["derive"]} |
| 30 | 30 | comrak = {version = "0.18.0", features = ["shortcodes"]} |
| @@ -54,7 +54,9 @@ url = {version = "^2.2.2", features = ["serde"]} | ||
| 54 | 54 | edit = "0.1.4" |
| 55 | 55 | |
| 56 | 56 | [dependencies.modalkit] |
| 57 | version = "0.0.16" | |
| 57 | # version = "0.0.16" | |
| 58 | git = "https://github.com/ulyssa/modalkit" | |
| 59 | rev = "f9f0517ed6a6152c1eab36d2e71b11f38831d5e6" | |
| 58 | 60 | |
| 59 | 61 | [dependencies.matrix-sdk] |
| 60 | 62 | version = "^0.6.2" |
src/base.rs +16 −14
| @@ -76,7 +76,7 @@ use modalkit::{ | ||
| 76 | 76 | tui::{ |
| 77 | 77 | buffer::Buffer, |
| 78 | 78 | layout::{Alignment, Rect}, |
| 79 | text::{Span, Spans}, | |
| 79 | text::{Line, Span}, | |
| 80 | 80 | widgets::{Paragraph, Widget}, |
| 81 | 81 | }, |
| 82 | 82 | }; |
| @@ -174,6 +174,7 @@ pub enum CreateRoomType { | ||
| 174 | 174 | |
| 175 | 175 | bitflags::bitflags! { |
| 176 | 176 | /// Available options for newly created rooms. |
| 177 | #[derive(Clone, Debug, Eq, PartialEq)] | |
| 177 | 178 | pub struct CreateRoomFlags: u32 { |
| 178 | 179 | /// No flags specified. |
| 179 | 180 | const NONE = 0b00000000; |
| @@ -188,6 +189,7 @@ bitflags::bitflags! { | ||
| 188 | 189 | |
| 189 | 190 | bitflags::bitflags! { |
| 190 | 191 | /// Available options when downloading files. |
| 192 | #[derive(Clone, Debug, Eq, PartialEq)] | |
| 191 | 193 | pub struct DownloadFlags: u32 { |
| 192 | 194 | /// No flags specified. |
| 193 | 195 | const NONE = 0b00000000; |
| @@ -701,30 +703,30 @@ impl RoomInfo { | ||
| 701 | 703 | } |
| 702 | 704 | } |
| 703 | 705 | |
| 704 | fn get_typing_spans<'a>(&'a self, settings: &'a ApplicationSettings) -> Spans<'a> { | |
| 706 | fn get_typing_spans<'a>(&'a self, settings: &'a ApplicationSettings) -> Line<'a> { | |
| 705 | 707 | let typers = self.get_typers(); |
| 706 | 708 | let n = typers.len(); |
| 707 | 709 | |
| 708 | 710 | match n { |
| 709 | 0 => Spans(vec![]), | |
| 711 | 0 => Line::from(vec![]), | |
| 710 | 712 | 1 => { |
| 711 | 713 | let user = settings.get_user_span(typers[0].as_ref(), self); |
| 712 | 714 | |
| 713 | Spans(vec![user, Span::from(" is typing...")]) | |
| 715 | Line::from(vec![user, Span::from(" is typing...")]) | |
| 714 | 716 | }, |
| 715 | 717 | 2 => { |
| 716 | 718 | let user1 = settings.get_user_span(typers[0].as_ref(), self); |
| 717 | 719 | let user2 = settings.get_user_span(typers[1].as_ref(), self); |
| 718 | 720 | |
| 719 | Spans(vec![ | |
| 721 | Line::from(vec![ | |
| 720 | 722 | user1, |
| 721 | 723 | Span::raw(" and "), |
| 722 | 724 | user2, |
| 723 | 725 | Span::from(" are typing..."), |
| 724 | 726 | ]) |
| 725 | 727 | }, |
| 726 | n if n < 5 => Spans::from("Several people are typing..."), | |
| 727 | _ => Spans::from("Many people are typing..."), | |
| 728 | n if n < 5 => Line::from("Several people are typing..."), | |
| 729 | _ => Line::from("Many people are typing..."), | |
| 728 | 730 | } |
| 729 | 731 | } |
| 730 | 732 | |
| @@ -1364,19 +1366,19 @@ pub mod tests { | ||
| 1364 | 1366 | |
| 1365 | 1367 | // Nothing set. |
| 1366 | 1368 | assert_eq!(info.users_typing, None); |
| 1367 | assert_eq!(info.get_typing_spans(&settings), Spans(vec![])); | |
| 1369 | assert_eq!(info.get_typing_spans(&settings), Line::from(vec![])); | |
| 1368 | 1370 | |
| 1369 | 1371 | // Empty typing list. |
| 1370 | 1372 | info.set_typing(users0); |
| 1371 | 1373 | assert!(info.users_typing.is_some()); |
| 1372 | assert_eq!(info.get_typing_spans(&settings), Spans(vec![])); | |
| 1374 | assert_eq!(info.get_typing_spans(&settings), Line::from(vec![])); | |
| 1373 | 1375 | |
| 1374 | 1376 | // Single user typing. |
| 1375 | 1377 | info.set_typing(users1); |
| 1376 | 1378 | assert!(info.users_typing.is_some()); |
| 1377 | 1379 | assert_eq!( |
| 1378 | 1380 | info.get_typing_spans(&settings), |
| 1379 | Spans(vec![ | |
| 1381 | Line::from(vec![ | |
| 1380 | 1382 | Span::styled("@user1:example.com", user_style("@user1:example.com")), |
| 1381 | 1383 | Span::from(" is typing...") |
| 1382 | 1384 | ]) |
| @@ -1387,7 +1389,7 @@ pub mod tests { | ||
| 1387 | 1389 | assert!(info.users_typing.is_some()); |
| 1388 | 1390 | assert_eq!( |
| 1389 | 1391 | info.get_typing_spans(&settings), |
| 1390 | Spans(vec![ | |
| 1392 | Line::from(vec![ | |
| 1391 | 1393 | Span::styled("@user1:example.com", user_style("@user1:example.com")), |
| 1392 | 1394 | Span::raw(" and "), |
| 1393 | 1395 | Span::styled("@user2:example.com", user_style("@user2:example.com")), |
| @@ -1398,19 +1400,19 @@ pub mod tests { | ||
| 1398 | 1400 | // Four users typing. |
| 1399 | 1401 | info.set_typing(users4); |
| 1400 | 1402 | assert!(info.users_typing.is_some()); |
| 1401 | assert_eq!(info.get_typing_spans(&settings), Spans::from("Several people are typing...")); | |
| 1403 | assert_eq!(info.get_typing_spans(&settings), Line::from("Several people are typing...")); | |
| 1402 | 1404 | |
| 1403 | 1405 | // Five users typing. |
| 1404 | 1406 | info.set_typing(users5); |
| 1405 | 1407 | assert!(info.users_typing.is_some()); |
| 1406 | assert_eq!(info.get_typing_spans(&settings), Spans::from("Many people are typing...")); | |
| 1408 | assert_eq!(info.get_typing_spans(&settings), Line::from("Many people are typing...")); | |
| 1407 | 1409 | |
| 1408 | 1410 | // Test that USER5 gets rendered using the configured color and name. |
| 1409 | 1411 | info.set_typing(vec![TEST_USER5.clone()]); |
| 1410 | 1412 | assert!(info.users_typing.is_some()); |
| 1411 | 1413 | assert_eq!( |
| 1412 | 1414 | info.get_typing_spans(&settings), |
| 1413 | Spans(vec![ | |
| 1415 | Line::from(vec![ | |
| 1414 | 1416 | Span::styled("USER 5", user_style_from_color(Color::Black)), |
| 1415 | 1417 | Span::from(" is typing...") |
| 1416 | 1418 | ]) |
src/message/html.rs +71 −71
| @@ -29,7 +29,7 @@ use modalkit::tui::{ | ||
| 29 | 29 | layout::Alignment, |
| 30 | 30 | style::{Color, Modifier as StyleModifier, Style}, |
| 31 | 31 | symbols::line, |
| 32 | text::{Span, Spans, Text}, | |
| 32 | text::{Line, Span, Text}, | |
| 33 | 33 | }; |
| 34 | 34 | |
| 35 | 35 | use crate::{ |
| @@ -151,8 +151,8 @@ impl Table { | ||
| 151 | 151 | caption.print(&mut printer, style); |
| 152 | 152 | |
| 153 | 153 | for mut line in printer.finish().lines { |
| 154 | line.0.insert(0, Span::styled(" ", style)); | |
| 155 | line.0.push(Span::styled(" ", style)); | |
| 154 | line.spans.insert(0, Span::styled(" ", style)); | |
| 155 | line.spans.push(Span::styled(" ", style)); | |
| 156 | 156 | text.lines.push(line); |
| 157 | 157 | } |
| 158 | 158 | } |
| @@ -182,7 +182,7 @@ impl Table { | ||
| 182 | 182 | ruler.push_str(line::VERTICAL_LEFT); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | text.lines.push(Spans(vec![Span::styled(ruler, style)])); | |
| 185 | text.lines.push(Line::from(vec![Span::styled(ruler, style)])); | |
| 186 | 186 | |
| 187 | 187 | let cells = cell_widths |
| 188 | 188 | .iter() |
| @@ -228,7 +228,7 @@ impl Table { | ||
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | ruler.push_str(line::BOTTOM_RIGHT); |
| 231 | text.lines.push(Spans(vec![Span::styled(ruler, style)])); | |
| 231 | text.lines.push(Line::from(vec![Span::styled(ruler, style)])); | |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | text |
| @@ -269,7 +269,7 @@ impl StyleTreeNode { | ||
| 269 | 269 | child.print(&mut subp, style); |
| 270 | 270 | |
| 271 | 271 | for mut line in subp.finish() { |
| 272 | line.0.insert(0, Span::styled(" ", style)); | |
| 272 | line.spans.insert(0, Span::styled(" ", style)); | |
| 273 | 273 | printer.push_line(line); |
| 274 | 274 | } |
| 275 | 275 | }, |
| @@ -309,7 +309,7 @@ impl StyleTreeNode { | ||
| 309 | 309 | Span::styled(" ".repeat(liw), style) |
| 310 | 310 | }; |
| 311 | 311 | |
| 312 | line.0.insert(0, leading); | |
| 312 | line.spans.insert(0, leading); | |
| 313 | 313 | printer.push_line(line); |
| 314 | 314 | } |
| 315 | 315 | } |
| @@ -336,8 +336,8 @@ impl StyleTreeNode { | ||
| 336 | 336 | ); |
| 337 | 337 | |
| 338 | 338 | for mut line in subp.finish() { |
| 339 | line.0.insert(0, Span::styled(line::VERTICAL, style)); | |
| 340 | line.0.push(Span::styled(line::VERTICAL, style)); | |
| 339 | line.spans.insert(0, Span::styled(line::VERTICAL, style)); | |
| 340 | line.spans.push(Span::styled(line::VERTICAL, style)); | |
| 341 | 341 | printer.push_line(line); |
| 342 | 342 | } |
| 343 | 343 | |
| @@ -683,7 +683,7 @@ pub mod tests { | ||
| 683 | 683 | let s = "<h1>Header 1</h1>"; |
| 684 | 684 | let tree = parse_matrix_html(s); |
| 685 | 685 | let text = tree.to_text(20, Style::default(), false); |
| 686 | assert_eq!(text.lines, vec![Spans(vec![ | |
| 686 | assert_eq!(text.lines, vec![Line::from(vec![ | |
| 687 | 687 | Span::styled("#", bold), |
| 688 | 688 | Span::styled(" ", bold), |
| 689 | 689 | Span::styled("Header", bold), |
| @@ -695,7 +695,7 @@ pub mod tests { | ||
| 695 | 695 | let s = "<h2>Header 2</h2>"; |
| 696 | 696 | let tree = parse_matrix_html(s); |
| 697 | 697 | let text = tree.to_text(20, Style::default(), false); |
| 698 | assert_eq!(text.lines, vec![Spans(vec![ | |
| 698 | assert_eq!(text.lines, vec![Line::from(vec![ | |
| 699 | 699 | Span::styled("#", bold), |
| 700 | 700 | Span::styled("#", bold), |
| 701 | 701 | Span::styled(" ", bold), |
| @@ -708,7 +708,7 @@ pub mod tests { | ||
| 708 | 708 | let s = "<h3>Header 3</h3>"; |
| 709 | 709 | let tree = parse_matrix_html(s); |
| 710 | 710 | let text = tree.to_text(20, Style::default(), false); |
| 711 | assert_eq!(text.lines, vec![Spans(vec![ | |
| 711 | assert_eq!(text.lines, vec![Line::from(vec![ | |
| 712 | 712 | Span::styled("#", bold), |
| 713 | 713 | Span::styled("#", bold), |
| 714 | 714 | Span::styled("#", bold), |
| @@ -722,7 +722,7 @@ pub mod tests { | ||
| 722 | 722 | let s = "<h4>Header 4</h4>"; |
| 723 | 723 | let tree = parse_matrix_html(s); |
| 724 | 724 | let text = tree.to_text(20, Style::default(), false); |
| 725 | assert_eq!(text.lines, vec![Spans(vec![ | |
| 725 | assert_eq!(text.lines, vec![Line::from(vec![ | |
| 726 | 726 | Span::styled("#", bold), |
| 727 | 727 | Span::styled("#", bold), |
| 728 | 728 | Span::styled("#", bold), |
| @@ -737,7 +737,7 @@ pub mod tests { | ||
| 737 | 737 | let s = "<h5>Header 5</h5>"; |
| 738 | 738 | let tree = parse_matrix_html(s); |
| 739 | 739 | let text = tree.to_text(20, Style::default(), false); |
| 740 | assert_eq!(text.lines, vec![Spans(vec![ | |
| 740 | assert_eq!(text.lines, vec![Line::from(vec![ | |
| 741 | 741 | Span::styled("#", bold), |
| 742 | 742 | Span::styled("#", bold), |
| 743 | 743 | Span::styled("#", bold), |
| @@ -753,7 +753,7 @@ pub mod tests { | ||
| 753 | 753 | let s = "<h6>Header 6</h6>"; |
| 754 | 754 | let tree = parse_matrix_html(s); |
| 755 | 755 | let text = tree.to_text(20, Style::default(), false); |
| 756 | assert_eq!(text.lines, vec![Spans(vec![ | |
| 756 | assert_eq!(text.lines, vec![Line::from(vec![ | |
| 757 | 757 | Span::styled("#", bold), |
| 758 | 758 | Span::styled("#", bold), |
| 759 | 759 | Span::styled("#", bold), |
| @@ -780,7 +780,7 @@ pub mod tests { | ||
| 780 | 780 | let s = "<b>Bold!</b>"; |
| 781 | 781 | let tree = parse_matrix_html(s); |
| 782 | 782 | let text = tree.to_text(20, Style::default(), false); |
| 783 | assert_eq!(text.lines, vec![Spans(vec![ | |
| 783 | assert_eq!(text.lines, vec![Line::from(vec![ | |
| 784 | 784 | Span::styled("Bold", bold), |
| 785 | 785 | Span::styled("!", bold), |
| 786 | 786 | space_span(15, def) |
| @@ -789,7 +789,7 @@ pub mod tests { | ||
| 789 | 789 | let s = "<strong>Bold!</strong>"; |
| 790 | 790 | let tree = parse_matrix_html(s); |
| 791 | 791 | let text = tree.to_text(20, Style::default(), false); |
| 792 | assert_eq!(text.lines, vec![Spans(vec![ | |
| 792 | assert_eq!(text.lines, vec![Line::from(vec![ | |
| 793 | 793 | Span::styled("Bold", bold), |
| 794 | 794 | Span::styled("!", bold), |
| 795 | 795 | space_span(15, def) |
| @@ -798,7 +798,7 @@ pub mod tests { | ||
| 798 | 798 | let s = "<i>Italic!</i>"; |
| 799 | 799 | let tree = parse_matrix_html(s); |
| 800 | 800 | let text = tree.to_text(20, Style::default(), false); |
| 801 | assert_eq!(text.lines, vec![Spans(vec![ | |
| 801 | assert_eq!(text.lines, vec![Line::from(vec![ | |
| 802 | 802 | Span::styled("Italic", italic), |
| 803 | 803 | Span::styled("!", italic), |
| 804 | 804 | space_span(13, def) |
| @@ -807,7 +807,7 @@ pub mod tests { | ||
| 807 | 807 | let s = "<em>Italic!</em>"; |
| 808 | 808 | let tree = parse_matrix_html(s); |
| 809 | 809 | let text = tree.to_text(20, Style::default(), false); |
| 810 | assert_eq!(text.lines, vec![Spans(vec![ | |
| 810 | assert_eq!(text.lines, vec![Line::from(vec![ | |
| 811 | 811 | Span::styled("Italic", italic), |
| 812 | 812 | Span::styled("!", italic), |
| 813 | 813 | space_span(13, def) |
| @@ -816,7 +816,7 @@ pub mod tests { | ||
| 816 | 816 | let s = "<del>Strikethrough!</del>"; |
| 817 | 817 | let tree = parse_matrix_html(s); |
| 818 | 818 | let text = tree.to_text(20, Style::default(), false); |
| 819 | assert_eq!(text.lines, vec![Spans(vec![ | |
| 819 | assert_eq!(text.lines, vec![Line::from(vec![ | |
| 820 | 820 | Span::styled("Strikethrough", strike), |
| 821 | 821 | Span::styled("!", strike), |
| 822 | 822 | space_span(6, def) |
| @@ -825,7 +825,7 @@ pub mod tests { | ||
| 825 | 825 | let s = "<strike>Strikethrough!</strike>"; |
| 826 | 826 | let tree = parse_matrix_html(s); |
| 827 | 827 | let text = tree.to_text(20, Style::default(), false); |
| 828 | assert_eq!(text.lines, vec![Spans(vec![ | |
| 828 | assert_eq!(text.lines, vec![Line::from(vec![ | |
| 829 | 829 | Span::styled("Strikethrough", strike), |
| 830 | 830 | Span::styled("!", strike), |
| 831 | 831 | space_span(6, def) |
| @@ -834,7 +834,7 @@ pub mod tests { | ||
| 834 | 834 | let s = "<u>Underline!</u>"; |
| 835 | 835 | let tree = parse_matrix_html(s); |
| 836 | 836 | let text = tree.to_text(20, Style::default(), false); |
| 837 | assert_eq!(text.lines, vec![Spans(vec![ | |
| 837 | assert_eq!(text.lines, vec![Line::from(vec![ | |
| 838 | 838 | Span::styled("Underline", underl), |
| 839 | 839 | Span::styled("!", underl), |
| 840 | 840 | space_span(10, def) |
| @@ -843,7 +843,7 @@ pub mod tests { | ||
| 843 | 843 | let s = "<font color=\"#ff0000\">Red!</u>"; |
| 844 | 844 | let tree = parse_matrix_html(s); |
| 845 | 845 | let text = tree.to_text(20, Style::default(), false); |
| 846 | assert_eq!(text.lines, vec![Spans(vec![ | |
| 846 | assert_eq!(text.lines, vec![Line::from(vec![ | |
| 847 | 847 | Span::styled("Red", red), |
| 848 | 848 | Span::styled("!", red), |
| 849 | 849 | space_span(16, def) |
| @@ -852,7 +852,7 @@ pub mod tests { | ||
| 852 | 852 | let s = "<font color=\"red\">Red!</u>"; |
| 853 | 853 | let tree = parse_matrix_html(s); |
| 854 | 854 | let text = tree.to_text(20, Style::default(), false); |
| 855 | assert_eq!(text.lines, vec![Spans(vec![ | |
| 855 | assert_eq!(text.lines, vec![Line::from(vec![ | |
| 856 | 856 | Span::styled("Red", red), |
| 857 | 857 | Span::styled("!", red), |
| 858 | 858 | space_span(16, def) |
| @@ -867,22 +867,22 @@ pub mod tests { | ||
| 867 | 867 | assert_eq!(text.lines.len(), 7); |
| 868 | 868 | assert_eq!( |
| 869 | 869 | text.lines[0], |
| 870 | Spans(vec![Span::raw("Hello"), Span::raw(" "), Span::raw(" ")]) | |
| 870 | Line::from(vec![Span::raw("Hello"), Span::raw(" "), Span::raw(" ")]) | |
| 871 | 871 | ); |
| 872 | 872 | assert_eq!( |
| 873 | 873 | text.lines[1], |
| 874 | Spans(vec![Span::raw("world"), Span::raw("!"), Span::raw(" ")]) | |
| 874 | Line::from(vec![Span::raw("world"), Span::raw("!"), Span::raw(" ")]) | |
| 875 | 875 | ); |
| 876 | assert_eq!(text.lines[2], Spans(vec![Span::raw(" ")])); | |
| 877 | assert_eq!(text.lines[3], Spans(vec![Span::raw("Content"), Span::raw(" ")])); | |
| 878 | assert_eq!(text.lines[4], Spans(vec![Span::raw(" ")])); | |
| 876 | assert_eq!(text.lines[2], Line::from(vec![Span::raw(" ")])); | |
| 877 | assert_eq!(text.lines[3], Line::from(vec![Span::raw("Content"), Span::raw(" ")])); | |
| 878 | assert_eq!(text.lines[4], Line::from(vec![Span::raw(" ")])); | |
| 879 | 879 | assert_eq!( |
| 880 | 880 | text.lines[5], |
| 881 | Spans(vec![Span::raw("Goodbye"), Span::raw(" "), Span::raw(" ")]) | |
| 881 | Line::from(vec![Span::raw("Goodbye"), Span::raw(" "), Span::raw(" ")]) | |
| 882 | 882 | ); |
| 883 | 883 | assert_eq!( |
| 884 | 884 | text.lines[6], |
| 885 | Spans(vec![Span::raw("world"), Span::raw("!"), Span::raw(" ")]) | |
| 885 | Line::from(vec![Span::raw("world"), Span::raw("!"), Span::raw(" ")]) | |
| 886 | 886 | ); |
| 887 | 887 | } |
| 888 | 888 | |
| @@ -894,11 +894,11 @@ pub mod tests { | ||
| 894 | 894 | assert_eq!(text.lines.len(), 2); |
| 895 | 895 | assert_eq!( |
| 896 | 896 | text.lines[0], |
| 897 | Spans(vec![Span::raw(" "), Span::raw("Hello"), Span::raw(" ")]) | |
| 897 | Line::from(vec![Span::raw(" "), Span::raw("Hello"), Span::raw(" ")]) | |
| 898 | 898 | ); |
| 899 | 899 | assert_eq!( |
| 900 | 900 | text.lines[1], |
| 901 | Spans(vec![Span::raw(" "), Span::raw("world"), Span::raw("!")]) | |
| 901 | Line::from(vec![Span::raw(" "), Span::raw("world"), Span::raw("!")]) | |
| 902 | 902 | ); |
| 903 | 903 | } |
| 904 | 904 | |
| @@ -910,7 +910,7 @@ pub mod tests { | ||
| 910 | 910 | assert_eq!(text.lines.len(), 6); |
| 911 | 911 | assert_eq!( |
| 912 | 912 | text.lines[0], |
| 913 | Spans(vec![ | |
| 913 | Line::from(vec![ | |
| 914 | 914 | Span::raw("- "), |
| 915 | 915 | Span::raw("List"), |
| 916 | 916 | Span::raw(" "), |
| @@ -919,7 +919,7 @@ pub mod tests { | ||
| 919 | 919 | ); |
| 920 | 920 | assert_eq!( |
| 921 | 921 | text.lines[1], |
| 922 | Spans(vec![ | |
| 922 | Line::from(vec![ | |
| 923 | 923 | Span::raw(" "), |
| 924 | 924 | Span::raw("Item"), |
| 925 | 925 | Span::raw(" "), |
| @@ -928,7 +928,7 @@ pub mod tests { | ||
| 928 | 928 | ); |
| 929 | 929 | assert_eq!( |
| 930 | 930 | text.lines[2], |
| 931 | Spans(vec![ | |
| 931 | Line::from(vec![ | |
| 932 | 932 | Span::raw("- "), |
| 933 | 933 | Span::raw("List"), |
| 934 | 934 | Span::raw(" "), |
| @@ -937,7 +937,7 @@ pub mod tests { | ||
| 937 | 937 | ); |
| 938 | 938 | assert_eq!( |
| 939 | 939 | text.lines[3], |
| 940 | Spans(vec![ | |
| 940 | Line::from(vec![ | |
| 941 | 941 | Span::raw(" "), |
| 942 | 942 | Span::raw("Item"), |
| 943 | 943 | Span::raw(" "), |
| @@ -946,7 +946,7 @@ pub mod tests { | ||
| 946 | 946 | ); |
| 947 | 947 | assert_eq!( |
| 948 | 948 | text.lines[4], |
| 949 | Spans(vec![ | |
| 949 | Line::from(vec![ | |
| 950 | 950 | Span::raw("- "), |
| 951 | 951 | Span::raw("List"), |
| 952 | 952 | Span::raw(" "), |
| @@ -955,7 +955,7 @@ pub mod tests { | ||
| 955 | 955 | ); |
| 956 | 956 | assert_eq!( |
| 957 | 957 | text.lines[5], |
| 958 | Spans(vec![ | |
| 958 | Line::from(vec![ | |
| 959 | 959 | Span::raw(" "), |
| 960 | 960 | Span::raw("Item"), |
| 961 | 961 | Span::raw(" "), |
| @@ -972,7 +972,7 @@ pub mod tests { | ||
| 972 | 972 | assert_eq!(text.lines.len(), 6); |
| 973 | 973 | assert_eq!( |
| 974 | 974 | text.lines[0], |
| 975 | Spans(vec![ | |
| 975 | Line::from(vec![ | |
| 976 | 976 | Span::raw("1. "), |
| 977 | 977 | Span::raw("List"), |
| 978 | 978 | Span::raw(" "), |
| @@ -981,7 +981,7 @@ pub mod tests { | ||
| 981 | 981 | ); |
| 982 | 982 | assert_eq!( |
| 983 | 983 | text.lines[1], |
| 984 | Spans(vec![ | |
| 984 | Line::from(vec![ | |
| 985 | 985 | Span::raw(" "), |
| 986 | 986 | Span::raw("Item"), |
| 987 | 987 | Span::raw(" "), |
| @@ -990,7 +990,7 @@ pub mod tests { | ||
| 990 | 990 | ); |
| 991 | 991 | assert_eq!( |
| 992 | 992 | text.lines[2], |
| 993 | Spans(vec![ | |
| 993 | Line::from(vec![ | |
| 994 | 994 | Span::raw("2. "), |
| 995 | 995 | Span::raw("List"), |
| 996 | 996 | Span::raw(" "), |
| @@ -999,7 +999,7 @@ pub mod tests { | ||
| 999 | 999 | ); |
| 1000 | 1000 | assert_eq!( |
| 1001 | 1001 | text.lines[3], |
| 1002 | Spans(vec![ | |
| 1002 | Line::from(vec![ | |
| 1003 | 1003 | Span::raw(" "), |
| 1004 | 1004 | Span::raw("Item"), |
| 1005 | 1005 | Span::raw(" "), |
| @@ -1008,7 +1008,7 @@ pub mod tests { | ||
| 1008 | 1008 | ); |
| 1009 | 1009 | assert_eq!( |
| 1010 | 1010 | text.lines[4], |
| 1011 | Spans(vec![ | |
| 1011 | Line::from(vec![ | |
| 1012 | 1012 | Span::raw("3. "), |
| 1013 | 1013 | Span::raw("List"), |
| 1014 | 1014 | Span::raw(" "), |
| @@ -1017,7 +1017,7 @@ pub mod tests { | ||
| 1017 | 1017 | ); |
| 1018 | 1018 | assert_eq!( |
| 1019 | 1019 | text.lines[5], |
| 1020 | Spans(vec![ | |
| 1020 | Line::from(vec![ | |
| 1021 | 1021 | Span::raw(" "), |
| 1022 | 1022 | Span::raw("Item"), |
| 1023 | 1023 | Span::raw(" "), |
| @@ -1043,8 +1043,8 @@ pub mod tests { | ||
| 1043 | 1043 | assert_eq!(text.lines.len(), 11); |
| 1044 | 1044 | |
| 1045 | 1045 | // Table header |
| 1046 | assert_eq!(text.lines[0].0, vec![Span::raw("┌────┬────┬───┐")]); | |
| 1047 | assert_eq!(text.lines[1].0, vec![ | |
| 1046 | assert_eq!(text.lines[0].spans, vec![Span::raw("┌────┬────┬───┐")]); | |
| 1047 | assert_eq!(text.lines[1].spans, vec![ | |
| 1048 | 1048 | Span::raw("│"), |
| 1049 | 1049 | Span::styled("Colu", bold), |
| 1050 | 1050 | Span::raw("│"), |
| @@ -1053,7 +1053,7 @@ pub mod tests { | ||
| 1053 | 1053 | Span::styled("Col", bold), |
| 1054 | 1054 | Span::raw("│") |
| 1055 | 1055 | ]); |
| 1056 | assert_eq!(text.lines[2].0, vec![ | |
| 1056 | assert_eq!(text.lines[2].spans, vec![ | |
| 1057 | 1057 | Span::raw("│"), |
| 1058 | 1058 | Span::styled("mn", bold), |
| 1059 | 1059 | Span::styled(" ", bold), |
| @@ -1066,7 +1066,7 @@ pub mod tests { | ||
| 1066 | 1066 | Span::styled("umn", bold), |
| 1067 | 1067 | Span::raw("│") |
| 1068 | 1068 | ]); |
| 1069 | assert_eq!(text.lines[3].0, vec![ | |
| 1069 | assert_eq!(text.lines[3].spans, vec![ | |
| 1070 | 1070 | Span::raw("│"), |
| 1071 | 1071 | Span::raw(" "), |
| 1072 | 1072 | Span::raw("│"), |
| @@ -1078,8 +1078,8 @@ pub mod tests { | ||
| 1078 | 1078 | ]); |
| 1079 | 1079 | |
| 1080 | 1080 | // First row |
| 1081 | assert_eq!(text.lines[4].0, vec![Span::raw("├────┼────┼───┤")]); | |
| 1082 | assert_eq!(text.lines[5].0, vec![ | |
| 1081 | assert_eq!(text.lines[4].spans, vec![Span::raw("├────┼────┼───┤")]); | |
| 1082 | assert_eq!(text.lines[5].spans, vec![ | |
| 1083 | 1083 | Span::raw("│"), |
| 1084 | 1084 | Span::raw("a"), |
| 1085 | 1085 | Span::raw(" "), |
| @@ -1093,8 +1093,8 @@ pub mod tests { | ||
| 1093 | 1093 | ]); |
| 1094 | 1094 | |
| 1095 | 1095 | // Second row |
| 1096 | assert_eq!(text.lines[6].0, vec![Span::raw("├────┼────┼───┤")]); | |
| 1097 | assert_eq!(text.lines[7].0, vec![ | |
| 1096 | assert_eq!(text.lines[6].spans, vec![Span::raw("├────┼────┼───┤")]); | |
| 1097 | assert_eq!(text.lines[7].spans, vec![ | |
| 1098 | 1098 | Span::raw("│"), |
| 1099 | 1099 | Span::raw("a"), |
| 1100 | 1100 | Span::raw(" "), |
| @@ -1108,8 +1108,8 @@ pub mod tests { | ||
| 1108 | 1108 | ]); |
| 1109 | 1109 | |
| 1110 | 1110 | // Third row |
| 1111 | assert_eq!(text.lines[8].0, vec![Span::raw("├────┼────┼───┤")]); | |
| 1112 | assert_eq!(text.lines[9].0, vec![ | |
| 1111 | assert_eq!(text.lines[8].spans, vec![Span::raw("├────┼────┼───┤")]); | |
| 1112 | assert_eq!(text.lines[9].spans, vec![ | |
| 1113 | 1113 | Span::raw("│"), |
| 1114 | 1114 | Span::raw("a"), |
| 1115 | 1115 | Span::raw(" "), |
| @@ -1123,7 +1123,7 @@ pub mod tests { | ||
| 1123 | 1123 | ]); |
| 1124 | 1124 | |
| 1125 | 1125 | // Bottom ruler |
| 1126 | assert_eq!(text.lines[10].0, vec![Span::raw("└────┴────┴───┘")]); | |
| 1126 | assert_eq!(text.lines[10].spans, vec![Span::raw("└────┴────┴───┘")]); | |
| 1127 | 1127 | } |
| 1128 | 1128 | |
| 1129 | 1129 | #[test] |
| @@ -1135,7 +1135,7 @@ pub mod tests { | ||
| 1135 | 1135 | assert_eq!(text.lines.len(), 4); |
| 1136 | 1136 | assert_eq!( |
| 1137 | 1137 | text.lines[0], |
| 1138 | Spans(vec![ | |
| 1138 | Line::from(vec![ | |
| 1139 | 1139 | Span::raw("This"), |
| 1140 | 1140 | Span::raw(" "), |
| 1141 | 1141 | Span::raw("was"), |
| @@ -1145,11 +1145,11 @@ pub mod tests { | ||
| 1145 | 1145 | ); |
| 1146 | 1146 | assert_eq!( |
| 1147 | 1147 | text.lines[1], |
| 1148 | Spans(vec![Span::raw("replied"), Span::raw(" "), Span::raw("to")]) | |
| 1148 | Line::from(vec![Span::raw("replied"), Span::raw(" "), Span::raw("to")]) | |
| 1149 | 1149 | ); |
| 1150 | 1150 | assert_eq!( |
| 1151 | 1151 | text.lines[2], |
| 1152 | Spans(vec![ | |
| 1152 | Line::from(vec![ | |
| 1153 | 1153 | Span::raw("This"), |
| 1154 | 1154 | Span::raw(" "), |
| 1155 | 1155 | Span::raw("is"), |
| @@ -1159,7 +1159,7 @@ pub mod tests { | ||
| 1159 | 1159 | ); |
| 1160 | 1160 | assert_eq!( |
| 1161 | 1161 | text.lines[3], |
| 1162 | Spans(vec![ | |
| 1162 | Line::from(vec![ | |
| 1163 | 1163 | Span::raw("the"), |
| 1164 | 1164 | Span::raw(" "), |
| 1165 | 1165 | Span::raw("reply"), |
| @@ -1172,7 +1172,7 @@ pub mod tests { | ||
| 1172 | 1172 | assert_eq!(text.lines.len(), 2); |
| 1173 | 1173 | assert_eq!( |
| 1174 | 1174 | text.lines[0], |
| 1175 | Spans(vec![ | |
| 1175 | Line::from(vec![ | |
| 1176 | 1176 | Span::raw("This"), |
| 1177 | 1177 | Span::raw(" "), |
| 1178 | 1178 | Span::raw("is"), |
| @@ -1182,7 +1182,7 @@ pub mod tests { | ||
| 1182 | 1182 | ); |
| 1183 | 1183 | assert_eq!( |
| 1184 | 1184 | text.lines[1], |
| 1185 | Spans(vec![ | |
| 1185 | Line::from(vec![ | |
| 1186 | 1186 | Span::raw("the"), |
| 1187 | 1187 | Span::raw(" "), |
| 1188 | 1188 | Span::raw("reply"), |
| @@ -1197,9 +1197,9 @@ pub mod tests { | ||
| 1197 | 1197 | let tree = parse_matrix_html(s); |
| 1198 | 1198 | let text = tree.to_text(7, Style::default(), true); |
| 1199 | 1199 | assert_eq!(text.lines.len(), 3); |
| 1200 | assert_eq!(text.lines[0], Spans(vec![Span::raw("Hello"), Span::raw(" "),])); | |
| 1201 | assert_eq!(text.lines[1], Spans(vec![Span::raw("World"), Span::raw(" "),])); | |
| 1202 | assert_eq!(text.lines[2], Spans(vec![Span::raw("Goodbye")]),); | |
| 1200 | assert_eq!(text.lines[0], Line::from(vec![Span::raw("Hello"), Span::raw(" "),])); | |
| 1201 | assert_eq!(text.lines[1], Line::from(vec![Span::raw("World"), Span::raw(" "),])); | |
| 1202 | assert_eq!(text.lines[2], Line::from(vec![Span::raw("Goodbye")]),); | |
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | 1205 | #[test] |
| @@ -1210,7 +1210,7 @@ pub mod tests { | ||
| 1210 | 1210 | assert_eq!(text.lines.len(), 1); |
| 1211 | 1211 | assert_eq!( |
| 1212 | 1212 | text.lines[0], |
| 1213 | Spans(vec![ | |
| 1213 | Line::from(vec![ | |
| 1214 | 1214 | Span::raw("Hello"), |
| 1215 | 1215 | Span::raw(" "), |
| 1216 | 1216 | Span::raw("World"), |
| @@ -1233,7 +1233,7 @@ pub mod tests { | ||
| 1233 | 1233 | assert_eq!(text.lines.len(), 5); |
| 1234 | 1234 | assert_eq!( |
| 1235 | 1235 | text.lines[0], |
| 1236 | Spans(vec![ | |
| 1236 | Line::from(vec![ | |
| 1237 | 1237 | Span::raw(line::TOP_LEFT), |
| 1238 | 1238 | Span::raw(line::HORIZONTAL.repeat(23)), |
| 1239 | 1239 | Span::raw(line::TOP_RIGHT) |
| @@ -1241,7 +1241,7 @@ pub mod tests { | ||
| 1241 | 1241 | ); |
| 1242 | 1242 | assert_eq!( |
| 1243 | 1243 | text.lines[1], |
| 1244 | Spans(vec![ | |
| 1244 | Line::from(vec![ | |
| 1245 | 1245 | Span::raw(line::VERTICAL), |
| 1246 | 1246 | Span::raw("fn"), |
| 1247 | 1247 | Span::raw(" "), |
| @@ -1261,7 +1261,7 @@ pub mod tests { | ||
| 1261 | 1261 | ); |
| 1262 | 1262 | assert_eq!( |
| 1263 | 1263 | text.lines[2], |
| 1264 | Spans(vec![ | |
| 1264 | Line::from(vec![ | |
| 1265 | 1265 | Span::raw(line::VERTICAL), |
| 1266 | 1266 | Span::raw(" "), |
| 1267 | 1267 | Span::raw("return"), |
| @@ -1274,7 +1274,7 @@ pub mod tests { | ||
| 1274 | 1274 | ); |
| 1275 | 1275 | assert_eq!( |
| 1276 | 1276 | text.lines[3], |
| 1277 | Spans(vec![ | |
| 1277 | Line::from(vec![ | |
| 1278 | 1278 | Span::raw(line::VERTICAL), |
| 1279 | 1279 | Span::raw("}"), |
| 1280 | 1280 | Span::raw(" ".repeat(22)), |
| @@ -1283,7 +1283,7 @@ pub mod tests { | ||
| 1283 | 1283 | ); |
| 1284 | 1284 | assert_eq!( |
| 1285 | 1285 | text.lines[4], |
| 1286 | Spans(vec![ | |
| 1286 | Line::from(vec![ | |
| 1287 | 1287 | Span::raw(line::BOTTOM_LEFT), |
| 1288 | 1288 | Span::raw(line::HORIZONTAL.repeat(23)), |
| 1289 | 1289 | Span::raw(line::BOTTOM_RIGHT) |
src/message/mod.rs +17 −15
| @@ -47,7 +47,7 @@ use matrix_sdk::ruma::{ | ||
| 47 | 47 | use modalkit::tui::{ |
| 48 | 48 | style::{Modifier as StyleModifier, Style}, |
| 49 | 49 | symbols::line::THICK_VERTICAL, |
| 50 | text::{Span, Spans, Text}, | |
| 50 | text::{Line, Span, Text}, | |
| 51 | 51 | }; |
| 52 | 52 | |
| 53 | 53 | use modalkit::editing::{base::ViewportContext, cursor::Cursor}; |
| @@ -74,6 +74,7 @@ const fn span_static(s: &'static str) -> Span<'static> { | ||
| 74 | 74 | bg: None, |
| 75 | 75 | add_modifier: StyleModifier::empty(), |
| 76 | 76 | sub_modifier: StyleModifier::empty(), |
| 77 | underline_color: None, | |
| 77 | 78 | }, |
| 78 | 79 | } |
| 79 | 80 | } |
| @@ -83,6 +84,7 @@ const BOLD_STYLE: Style = Style { | ||
| 83 | 84 | bg: None, |
| 84 | 85 | add_modifier: StyleModifier::BOLD, |
| 85 | 86 | sub_modifier: StyleModifier::empty(), |
| 87 | underline_color: None, | |
| 86 | 88 | }; |
| 87 | 89 | |
| 88 | 90 | const USER_GUTTER: usize = 30; |
| @@ -508,14 +510,14 @@ impl<'a> MessageFormatter<'a> { | ||
| 508 | 510 | } |
| 509 | 511 | |
| 510 | 512 | #[inline] |
| 511 | fn push_spans(&mut self, spans: Spans<'a>, style: Style, text: &mut Text<'a>) { | |
| 513 | fn push_spans(&mut self, prev_line: Line<'a>, style: Style, text: &mut Text<'a>) { | |
| 512 | 514 | if let Some(date) = self.date.take() { |
| 513 | 515 | let len = date.content.as_ref().len(); |
| 514 | 516 | let padding = self.orig.saturating_sub(len); |
| 515 | 517 | let leading = space_span(padding / 2, Style::default()); |
| 516 | 518 | let trailing = space_span(padding.saturating_sub(padding / 2), Style::default()); |
| 517 | 519 | |
| 518 | text.lines.push(Spans(vec![leading, date, trailing])); | |
| 520 | text.lines.push(Line::from(vec![leading, date, trailing])); | |
| 519 | 521 | } |
| 520 | 522 | |
| 521 | 523 | match self.cols { |
| @@ -525,7 +527,7 @@ impl<'a> MessageFormatter<'a> { | ||
| 525 | 527 | let time = self.time.take().unwrap_or(TIME_GUTTER_EMPTY_SPAN); |
| 526 | 528 | |
| 527 | 529 | let mut line = vec![user]; |
| 528 | line.extend(spans.0); | |
| 530 | line.extend(prev_line.spans); | |
| 529 | 531 | line.push(time); |
| 530 | 532 | |
| 531 | 533 | // Show read receipts. |
| @@ -542,35 +544,35 @@ impl<'a> MessageFormatter<'a> { | ||
| 542 | 544 | line.push(a); |
| 543 | 545 | line.push(Span::raw(" ")); |
| 544 | 546 | |
| 545 | text.lines.push(Spans(line)) | |
| 547 | text.lines.push(Line::from(line)) | |
| 546 | 548 | }, |
| 547 | 549 | MessageColumns::Three => { |
| 548 | 550 | let user = self.user.take().unwrap_or(USER_GUTTER_EMPTY_SPAN); |
| 549 | 551 | let time = self.time.take().unwrap_or_else(|| Span::from("")); |
| 550 | 552 | |
| 551 | 553 | let mut line = vec![user]; |
| 552 | line.extend(spans.0); | |
| 554 | line.extend(prev_line.spans); | |
| 553 | 555 | line.push(time); |
| 554 | 556 | |
| 555 | text.lines.push(Spans(line)) | |
| 557 | text.lines.push(Line::from(line)) | |
| 556 | 558 | }, |
| 557 | 559 | MessageColumns::Two => { |
| 558 | 560 | let user = self.user.take().unwrap_or(USER_GUTTER_EMPTY_SPAN); |
| 559 | 561 | let mut line = vec![user]; |
| 560 | line.extend(spans.0); | |
| 562 | line.extend(prev_line.spans); | |
| 561 | 563 | |
| 562 | text.lines.push(Spans(line)); | |
| 564 | text.lines.push(Line::from(line)); | |
| 563 | 565 | }, |
| 564 | 566 | MessageColumns::One => { |
| 565 | 567 | if let Some(user) = self.user.take() { |
| 566 | text.lines.push(Spans(vec![user])); | |
| 568 | text.lines.push(Line::from(vec![user])); | |
| 567 | 569 | } |
| 568 | 570 | |
| 569 | 571 | let leading = space_span(2, style); |
| 570 | 572 | let mut line = vec![leading]; |
| 571 | line.extend(spans.0); | |
| 573 | line.extend(prev_line.spans); | |
| 572 | 574 | |
| 573 | text.lines.push(Spans(line)); | |
| 575 | text.lines.push(Line::from(line)); | |
| 574 | 576 | }, |
| 575 | 577 | } |
| 576 | 578 | } |
| @@ -709,7 +711,7 @@ impl Message { | ||
| 709 | 711 | sender.style = sender.style.patch(style); |
| 710 | 712 | |
| 711 | 713 | fmt.push_spans( |
| 712 | Spans(vec![ | |
| 714 | Line::from(vec![ | |
| 713 | 715 | Span::styled(" ", style), |
| 714 | 716 | Span::styled(THICK_VERTICAL, style), |
| 715 | 717 | sender, |
| @@ -721,8 +723,8 @@ impl Message { | ||
| 721 | 723 | ); |
| 722 | 724 | |
| 723 | 725 | for line in replied.lines.iter_mut() { |
| 724 | line.0.insert(0, Span::styled(THICK_VERTICAL, style)); | |
| 725 | line.0.insert(0, Span::styled(" ", style)); | |
| 726 | line.spans.insert(0, Span::styled(THICK_VERTICAL, style)); | |
| 727 | line.spans.insert(0, Span::styled(" ", style)); | |
| 726 | 728 | } |
| 727 | 729 | |
| 728 | 730 | fmt.push_text(replied, style, &mut text); |
src/message/printer.rs +5 −5
| @@ -7,7 +7,7 @@ use std::borrow::Cow; | ||
| 7 | 7 | |
| 8 | 8 | use modalkit::tui::layout::Alignment; |
| 9 | 9 | use modalkit::tui::style::Style; |
| 10 | use modalkit::tui::text::{Span, Spans, Text}; | |
| 10 | use modalkit::tui::text::{Line, Span, Text}; | |
| 11 | 11 | use unicode_segmentation::UnicodeSegmentation; |
| 12 | 12 | use unicode_width::UnicodeWidthStr; |
| 13 | 13 | |
| @@ -92,7 +92,7 @@ impl<'a> TextPrinter<'a> { | ||
| 92 | 92 | |
| 93 | 93 | fn push(&mut self) { |
| 94 | 94 | self.curr_width = 0; |
| 95 | self.text.lines.push(Spans(std::mem::take(&mut self.curr_spans))); | |
| 95 | self.text.lines.push(Line::from(std::mem::take(&mut self.curr_spans))); | |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /// Start a new line. |
| @@ -228,10 +228,10 @@ impl<'a> TextPrinter<'a> { | ||
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | /// Push [Spans] into the printer. | |
| 232 | pub fn push_line(&mut self, spans: Spans<'a>) { | |
| 231 | /// Push a [Line] into the printer. | |
| 232 | pub fn push_line(&mut self, line: Line<'a>) { | |
| 233 | 233 | self.commit(); |
| 234 | self.text.lines.push(spans); | |
| 234 | self.text.lines.push(line); | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /// Push multiline [Text] into the printer. |
src/util.rs +9 −7
| @@ -5,7 +5,7 @@ use unicode_segmentation::UnicodeSegmentation; | ||
| 5 | 5 | use unicode_width::UnicodeWidthStr; |
| 6 | 6 | |
| 7 | 7 | use modalkit::tui::style::Style; |
| 8 | use modalkit::tui::text::{Span, Spans, Text}; | |
| 8 | use modalkit::tui::text::{Line, Span, Text}; | |
| 9 | 9 | |
| 10 | 10 | pub fn split_cow(cow: Cow<'_, str>, idx: usize) -> (Cow<'_, str>, Cow<'_, str>) { |
| 11 | 11 | match cow { |
| @@ -106,7 +106,7 @@ where | ||
| 106 | 106 | |
| 107 | 107 | for (line, w) in wrap(s, width) { |
| 108 | 108 | let space = space_span(width.saturating_sub(w), style); |
| 109 | let spans = Spans(vec![Span::styled(line, style), space]); | |
| 109 | let spans = Line::from(vec![Span::styled(line, style), space]); | |
| 110 | 110 | |
| 111 | 111 | text.lines.push(spans); |
| 112 | 112 | } |
| @@ -128,17 +128,19 @@ pub fn space_text(width: usize, style: Style) -> Text<'static> { | ||
| 128 | 128 | |
| 129 | 129 | pub fn join_cell_text<'a>(texts: Vec<(Text<'a>, usize)>, join: Span<'a>, style: Style) -> Text<'a> { |
| 130 | 130 | let height = texts.iter().map(|t| t.0.height()).max().unwrap_or(0); |
| 131 | let mut text = Text { lines: vec![Spans(vec![join.clone()]); height] }; | |
| 131 | let mut text = Text { | |
| 132 | lines: vec![Line::from(vec![join.clone()]); height], | |
| 133 | }; | |
| 132 | 134 | |
| 133 | 135 | for (mut t, w) in texts.into_iter() { |
| 134 | 136 | for i in 0..height { |
| 135 | if let Some(spans) = t.lines.get_mut(i) { | |
| 136 | text.lines[i].0.append(&mut spans.0); | |
| 137 | if let Some(line) = t.lines.get_mut(i) { | |
| 138 | text.lines[i].spans.append(&mut line.spans); | |
| 137 | 139 | } else { |
| 138 | text.lines[i].0.push(space_span(w, style)); | |
| 140 | text.lines[i].spans.push(space_span(w, style)); | |
| 139 | 141 | } |
| 140 | 142 | |
| 141 | text.lines[i].0.push(join.clone()); | |
| 143 | text.lines[i].spans.push(join.clone()); | |
| 142 | 144 | } |
| 143 | 145 | } |
| 144 | 146 | |
src/windows/mod.rs +28 −28
| @@ -26,7 +26,7 @@ use modalkit::tui::{ | ||
| 26 | 26 | buffer::Buffer, |
| 27 | 27 | layout::{Alignment, Rect}, |
| 28 | 28 | style::{Modifier as StyleModifier, Style}, |
| 29 | text::{Span, Spans, Text}, | |
| 29 | text::{Line, Span, Text}, | |
| 30 | 30 | widgets::StatefulWidget, |
| 31 | 31 | }; |
| 32 | 32 | |
| @@ -102,7 +102,7 @@ fn bold_span(s: &str) -> Span { | ||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | #[inline] |
| 105 | fn bold_spans(s: &str) -> Spans { | |
| 105 | fn bold_spans(s: &str) -> Line { | |
| 106 | 106 | bold_span(s).into() |
| 107 | 107 | } |
| 108 | 108 | |
| @@ -537,7 +537,7 @@ impl Window<IambInfo> for IambWindow { | ||
| 537 | 537 | } |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | fn get_tab_title(&self, store: &mut ProgramStore) -> Spans { | |
| 540 | fn get_tab_title(&self, store: &mut ProgramStore) -> Line { | |
| 541 | 541 | match self { |
| 542 | 542 | IambWindow::DirectList(_) => bold_spans("Direct Messages"), |
| 543 | 543 | IambWindow::RoomList(_) => bold_spans("Rooms"), |
| @@ -548,7 +548,7 @@ impl Window<IambInfo> for IambWindow { | ||
| 548 | 548 | IambWindow::Room(w) => { |
| 549 | 549 | let title = store.application.get_room_title(w.id()); |
| 550 | 550 | |
| 551 | Spans::from(title) | |
| 551 | Line::from(title) | |
| 552 | 552 | }, |
| 553 | 553 | IambWindow::MemberList(state, room_id, _) => { |
| 554 | 554 | let title = store.application.get_room_title(room_id.as_ref()); |
| @@ -558,12 +558,12 @@ impl Window<IambInfo> for IambWindow { | ||
| 558 | 558 | Span::styled(format!("({n}): "), bold_style()), |
| 559 | 559 | title.into(), |
| 560 | 560 | ]; |
| 561 | Spans(v) | |
| 561 | Line::from(v) | |
| 562 | 562 | }, |
| 563 | 563 | } |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | fn get_win_title(&self, store: &mut ProgramStore) -> Spans { | |
| 566 | fn get_win_title(&self, store: &mut ProgramStore) -> Line { | |
| 567 | 567 | match self { |
| 568 | 568 | IambWindow::DirectList(_) => bold_spans("Direct Messages"), |
| 569 | 569 | IambWindow::RoomList(_) => bold_spans("Rooms"), |
| @@ -580,7 +580,7 @@ impl Window<IambInfo> for IambWindow { | ||
| 580 | 580 | Span::styled(format!("({n}): "), bold_style()), |
| 581 | 581 | title.into(), |
| 582 | 582 | ]; |
| 583 | Spans(v) | |
| 583 | Line::from(v) | |
| 584 | 584 | }, |
| 585 | 585 | } |
| 586 | 586 | } |
| @@ -730,7 +730,7 @@ impl ListItem<IambInfo> for RoomItem { | ||
| 730 | 730 | |
| 731 | 731 | append_tags(tags, &mut spans, style); |
| 732 | 732 | |
| 733 | Text::from(Spans(spans)) | |
| 733 | Text::from(Line::from(spans)) | |
| 734 | 734 | } else { |
| 735 | 735 | selected_text(self.name.as_str(), selected) |
| 736 | 736 | } |
| @@ -796,7 +796,7 @@ impl ListItem<IambInfo> for DirectItem { | ||
| 796 | 796 | |
| 797 | 797 | append_tags(tags, &mut spans, style); |
| 798 | 798 | |
| 799 | Text::from(Spans(spans)) | |
| 799 | Text::from(Line::from(spans)) | |
| 800 | 800 | } else { |
| 801 | 801 | selected_text(self.name.as_str(), selected) |
| 802 | 802 | } |
| @@ -1023,47 +1023,47 @@ impl ListItem<IambInfo> for VerifyItem { | ||
| 1023 | 1023 | |
| 1024 | 1024 | let bold = Style::default().add_modifier(StyleModifier::BOLD); |
| 1025 | 1025 | let item = Span::styled(self.show_item(), selected_style(selected)); |
| 1026 | lines.push(Spans::from(item)); | |
| 1026 | lines.push(Line::from(item)); | |
| 1027 | 1027 | |
| 1028 | 1028 | if self.sasv1.is_done() { |
| 1029 | 1029 | // Print nothing. |
| 1030 | 1030 | } else if self.sasv1.is_cancelled() { |
| 1031 | 1031 | if let Some(info) = self.sasv1.cancel_info() { |
| 1032 | lines.push(Spans::from(format!(" Cancelled: {}", info.reason()))); | |
| 1033 | lines.push(Spans::from("")); | |
| 1032 | lines.push(Line::from(format!(" Cancelled: {}", info.reason()))); | |
| 1033 | lines.push(Line::from("")); | |
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | lines.push(Spans::from(" You can start a new verification request with:")); | |
| 1036 | lines.push(Line::from(" You can start a new verification request with:")); | |
| 1037 | 1037 | } else if let Some(emoji) = self.sasv1.emoji() { |
| 1038 | lines.push(Spans::from( | |
| 1038 | lines.push(Line::from( | |
| 1039 | 1039 | " Both devices should see the following Emoji sequence:".to_string(), |
| 1040 | 1040 | )); |
| 1041 | lines.push(Spans::from("")); | |
| 1041 | lines.push(Line::from("")); | |
| 1042 | 1042 | |
| 1043 | 1043 | for line in format_emojis(emoji).lines() { |
| 1044 | lines.push(Spans::from(format!(" {line}"))); | |
| 1044 | lines.push(Line::from(format!(" {line}"))); | |
| 1045 | 1045 | } |
| 1046 | 1046 | |
| 1047 | lines.push(Spans::from("")); | |
| 1048 | lines.push(Spans::from(" If they don't match, run:")); | |
| 1049 | lines.push(Spans::from("")); | |
| 1050 | lines.push(Spans::from(Span::styled( | |
| 1047 | lines.push(Line::from("")); | |
| 1048 | lines.push(Line::from(" If they don't match, run:")); | |
| 1049 | lines.push(Line::from("")); | |
| 1050 | lines.push(Line::from(Span::styled( | |
| 1051 | 1051 | format!(":verify mismatch {}", self.user_dev), |
| 1052 | 1052 | bold, |
| 1053 | 1053 | ))); |
| 1054 | lines.push(Spans::from("")); | |
| 1055 | lines.push(Spans::from(" If everything looks right, you can confirm with:")); | |
| 1054 | lines.push(Line::from("")); | |
| 1055 | lines.push(Line::from(" If everything looks right, you can confirm with:")); | |
| 1056 | 1056 | } else { |
| 1057 | lines.push(Spans::from(" To accept this request, run:")); | |
| 1057 | lines.push(Line::from(" To accept this request, run:")); | |
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | 1060 | let cmd = self.to_string(); |
| 1061 | 1061 | |
| 1062 | 1062 | if !cmd.is_empty() { |
| 1063 | lines.push(Spans::from("")); | |
| 1064 | lines.push(Spans(vec![Span::from(" "), Span::styled(cmd, bold)])); | |
| 1065 | lines.push(Spans::from("")); | |
| 1066 | lines.push(Spans(vec![ | |
| 1063 | lines.push(Line::from("")); | |
| 1064 | lines.push(Line::from(vec![Span::from(" "), Span::styled(cmd, bold)])); | |
| 1065 | lines.push(Line::from("")); | |
| 1066 | lines.push(Line::from(vec![ | |
| 1067 | 1067 | Span::from("You can copy the above command with "), |
| 1068 | 1068 | Span::styled("yy", bold), |
| 1069 | 1069 | Span::from(" and then execute it with "), |
| @@ -1167,7 +1167,7 @@ impl ListItem<IambInfo> for MemberItem { | ||
| 1167 | 1167 | |
| 1168 | 1168 | spans.extend(state); |
| 1169 | 1169 | |
| 1170 | return Spans(spans).into(); | |
| 1170 | return Line::from(spans).into(); | |
| 1171 | 1171 | } |
| 1172 | 1172 | |
| 1173 | 1173 | fn get_word(&self) -> Option<String> { |
src/windows/room/chat.rs +3 −3
| @@ -35,7 +35,7 @@ use modalkit::{ | ||
| 35 | 35 | tui::{ |
| 36 | 36 | buffer::Buffer, |
| 37 | 37 | layout::Rect, |
| 38 | text::{Span, Spans}, | |
| 38 | text::{Line, Span}, | |
| 39 | 39 | widgets::{Paragraph, StatefulWidget, Widget}, |
| 40 | 40 | }, |
| 41 | 41 | widgets::textbox::{TextBox, TextBoxState}, |
| @@ -812,7 +812,7 @@ impl<'a> StatefulWidget for Chat<'a> { | ||
| 812 | 812 | // Determine whether we have a description to show for the message bar. |
| 813 | 813 | let desc_spans = match (&state.editing, &state.reply_to) { |
| 814 | 814 | (None, None) => None, |
| 815 | (Some(_), None) => Some(Spans::from("Editing message")), | |
| 815 | (Some(_), None) => Some(Line::from("Editing message")), | |
| 816 | 816 | (editing, Some(_)) => { |
| 817 | 817 | state.reply_to.as_ref().and_then(|k| { |
| 818 | 818 | let room = self.store.application.rooms.get(state.id())?; |
| @@ -824,7 +824,7 @@ impl<'a> StatefulWidget for Chat<'a> { | ||
| 824 | 824 | } else { |
| 825 | 825 | Span::from("Replying to ") |
| 826 | 826 | }; |
| 827 | let spans = Spans(vec![prefix, user]); | |
| 827 | let spans = Line::from(vec![prefix, user]); | |
| 828 | 828 | |
| 829 | 829 | spans.into() |
| 830 | 830 | }) |
src/windows/room/mod.rs +5 −5
| @@ -15,7 +15,7 @@ use modalkit::tui::{ | ||
| 15 | 15 | buffer::Buffer, |
| 16 | 16 | layout::{Alignment, Rect}, |
| 17 | 17 | style::{Modifier as StyleModifier, Style}, |
| 18 | text::{Span, Spans, Text}, | |
| 18 | text::{Line, Span, Text}, | |
| 19 | 19 | widgets::{Paragraph, StatefulWidget, Widget}, |
| 20 | 20 | }; |
| 21 | 21 | |
| @@ -150,8 +150,8 @@ impl RoomState { | ||
| 150 | 150 | invited.push(store.application.settings.get_user_span(inviter.user_id(), info)); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | let l1 = Spans(invited); | |
| 154 | let l2 = Spans::from( | |
| 153 | let l1 = Line::from(invited); | |
| 154 | let l2 = Line::from( | |
| 155 | 155 | "You can run `:invite accept` or `:invite reject` to accept or reject this invitation.", |
| 156 | 156 | ); |
| 157 | 157 | let text = Text { lines: vec![l1, l2] }; |
| @@ -305,7 +305,7 @@ impl RoomState { | ||
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | pub fn get_title(&self, store: &mut ProgramStore) -> Spans { | |
| 308 | pub fn get_title(&self, store: &mut ProgramStore) -> Line { | |
| 309 | 309 | let title = store.application.get_room_title(self.id()); |
| 310 | 310 | let style = Style::default().add_modifier(StyleModifier::BOLD); |
| 311 | 311 | let mut spans = vec![Span::styled(title, style)]; |
| @@ -319,7 +319,7 @@ impl RoomState { | ||
| 319 | 319 | _ => {}, |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | Spans(spans) | |
| 322 | Line::from(spans) | |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | pub fn focus_toggle(&mut self) { |
src/windows/room/scrollback.rs +3 −3
| @@ -9,7 +9,7 @@ use modalkit::tui::{ | ||
| 9 | 9 | buffer::Buffer, |
| 10 | 10 | layout::{Alignment, Rect}, |
| 11 | 11 | style::{Modifier as StyleModifier, Style}, |
| 12 | text::{Span, Spans}, | |
| 12 | text::{Line, Span}, | |
| 13 | 13 | widgets::{Paragraph, StatefulWidget, Widget}, |
| 14 | 14 | }; |
| 15 | 15 | use modalkit::widgets::{ScrollActions, TerminalCursor, WindowOps}; |
| @@ -1226,7 +1226,7 @@ fn render_jump_to_recent(area: Rect, buf: &mut Buffer, focused: bool) -> Rect { | ||
| 1226 | 1226 | Span::raw(" to jump to latest message"), |
| 1227 | 1227 | ]; |
| 1228 | 1228 | |
| 1229 | Paragraph::new(Spans::from(msg)) | |
| 1229 | Paragraph::new(Line::from(msg)) | |
| 1230 | 1230 | .alignment(Alignment::Center) |
| 1231 | 1231 | .render(bar, buf); |
| 1232 | 1232 | |
| @@ -1342,7 +1342,7 @@ impl<'a> StatefulWidget for Scrollback<'a> { | ||
| 1342 | 1342 | let x = area.left(); |
| 1343 | 1343 | |
| 1344 | 1344 | for (_, _, txt) in lines.into_iter() { |
| 1345 | let _ = buf.set_spans(x, y, &txt, area.width); | |
| 1345 | let _ = buf.set_line(x, y, &txt, area.width); | |
| 1346 | 1346 | |
| 1347 | 1347 | y += 1; |
| 1348 | 1348 | } |
src/windows/room/space.rs +2 −2
| @@ -11,7 +11,7 @@ use modalkit::tui::{ | ||
| 11 | 11 | buffer::Buffer, |
| 12 | 12 | layout::Rect, |
| 13 | 13 | style::{Color, Style}, |
| 14 | text::{Span, Spans, Text}, | |
| 14 | text::{Line, Span, Text}, | |
| 15 | 15 | widgets::StatefulWidget, |
| 16 | 16 | }; |
| 17 | 17 | |
| @@ -140,7 +140,7 @@ impl<'a> StatefulWidget for Space<'a> { | ||
| 140 | 140 | }, |
| 141 | 141 | Err(e) => { |
| 142 | 142 | let lines = vec![ |
| 143 | Spans::from("Unable to fetch space room hierarchy:"), | |
| 143 | Line::from("Unable to fetch space room hierarchy:"), | |
| 144 | 144 | Span::styled(e.to_string(), Style::default().fg(Color::Red)).into(), |
| 145 | 145 | ]; |
| 146 | 146 | |