Commit 95af00ba93

95af00ba93e0e784482258607571afc15e399000

parent: 9197864c5c

Unregistered key

Benjamin Große <ste3ls@gmail.com> · 2023-07-01 07:58 UTC
committer: <git@ulyssa.dev>

Update modalkit for newer ratatui and crossterm

Layout: unified · split

Cargo.lock +58 −28
@@ -687,27 +687,11 @@ dependencies = [
687687
688688[[package]]
689689name = "crossterm"
690version = "0.25.0"
691source = "registry+https://github.com/rust-lang/crates.io-index"
692checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67"
693dependencies = [
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]]
705name = "crossterm"
706version = "0.26.1"
690version = "0.27.0"
707691source = "registry+https://github.com/rust-lang/crates.io-index"
708checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13"
692checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df"
709693dependencies = [
710 "bitflags 1.3.2",
694 "bitflags 2.4.0",
711695 "crossterm_winapi",
712696 "libc",
713697 "mio",
@@ -1564,7 +1548,7 @@ name = "iamb"
15641548version = "0.0.9-alpha.1"
15651549dependencies = [
15661550 "arboard",
1567 "bitflags 1.3.2",
1551 "bitflags 2.4.0",
15681552 "chrono",
15691553 "clap",
15701554 "comrak",
@@ -1694,6 +1678,12 @@ dependencies = [
16941678 "hashbrown 0.14.1",
16951679]
16961680
1681[[package]]
1682name = "indoc"
1683version = "2.0.4"
1684source = "registry+https://github.com/rust-lang/crates.io-index"
1685checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8"
1686
16971687[[package]]
16981688name = "inout"
16991689version = "0.1.3"
@@ -1762,6 +1752,15 @@ dependencies = [
17621752 "either",
17631753]
17641754
1755[[package]]
1756name = "itertools"
1757version = "0.11.0"
1758source = "registry+https://github.com/rust-lang/crates.io-index"
1759checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
1760dependencies = [
1761 "either",
1762]
1763
17651764[[package]]
17661765name = "itoa"
17671766version = "1.0.9"
@@ -2187,13 +2186,12 @@ dependencies = [
21872186[[package]]
21882187name = "modalkit"
21892188version = "0.0.16"
2190source = "registry+https://github.com/rust-lang/crates.io-index"
2191checksum = "3f38eef0b4f6377e73d1082d508cae1df4d99a94d25361538131d839f292aa49"
2189source = "git+https://github.com/ulyssa/modalkit?rev=f9f0517ed6a6152c1eab36d2e71b11f38831d5e6#f9f0517ed6a6152c1eab36d2e71b11f38831d5e6"
21922190dependencies = [
21932191 "anymap2",
21942192 "arboard",
21952193 "bitflags 1.3.2",
2196 "crossterm 0.25.0",
2194 "crossterm",
21972195 "derive_more",
21982196 "intervaltree",
21992197 "libc",
@@ -2452,6 +2450,12 @@ dependencies = [
24522450 "subtle",
24532451]
24542452
2453[[package]]
2454name = "paste"
2455version = "1.0.14"
2456source = "registry+https://github.com/rust-lang/crates.io-index"
2457checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
2458
24552459[[package]]
24562460name = "pathdiff"
24572461version = "0.2.1"
@@ -2676,7 +2680,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
26762680checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4"
26772681dependencies = [
26782682 "anyhow",
2679 "itertools",
2683 "itertools 0.10.5",
26802684 "proc-macro2",
26812685 "quote",
26822686 "syn 1.0.109",
@@ -2804,13 +2808,17 @@ dependencies = [
28042808
28052809[[package]]
28062810name = "ratatui"
2807version = "0.20.1"
2811version = "0.23.0"
28082812source = "registry+https://github.com/rust-lang/crates.io-index"
2809checksum = "dcc0d032bccba900ee32151ec0265667535c230169f5a011154cdcd984e16829"
2813checksum = "2e2e4cd95294a85c3b4446e63ef054eea43e0205b1fd60120c16b74ff7ff96ad"
28102814dependencies = [
2811 "bitflags 1.3.2",
2815 "bitflags 2.4.0",
28122816 "cassowary",
2813 "crossterm 0.26.1",
2817 "crossterm",
2818 "indoc",
2819 "itertools 0.11.0",
2820 "paste",
2821 "strum",
28142822 "unicode-segmentation",
28152823 "unicode-width",
28162824]
@@ -3473,6 +3481,28 @@ version = "0.10.0"
34733481source = "registry+https://github.com/rust-lang/crates.io-index"
34743482checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
34753483
3484[[package]]
3485name = "strum"
3486version = "0.25.0"
3487source = "registry+https://github.com/rust-lang/crates.io-index"
3488checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125"
3489dependencies = [
3490 "strum_macros",
3491]
3492
3493[[package]]
3494name = "strum_macros"
3495version = "0.25.2"
3496source = "registry+https://github.com/rust-lang/crates.io-index"
3497checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059"
3498dependencies = [
3499 "heck",
3500 "proc-macro2",
3501 "quote",
3502 "rustversion",
3503 "syn 2.0.38",
3504]
3505
34763506[[package]]
34773507name = "subtle"
34783508version = "2.5.0"
Cargo.toml +4 −2
@@ -24,7 +24,7 @@ features = ["build", "git", "gitcl",]
2424
2525[dependencies]
2626arboard = "3.2.0"
27bitflags = "1.3.2"
27bitflags = "^2.3"
2828chrono = "0.4"
2929clap = {version = "~4.3", features = ["derive"]}
3030comrak = {version = "0.18.0", features = ["shortcodes"]}
@@ -54,7 +54,9 @@ url = {version = "^2.2.2", features = ["serde"]}
5454edit = "0.1.4"
5555
5656[dependencies.modalkit]
57version = "0.0.16"
57# version = "0.0.16"
58git = "https://github.com/ulyssa/modalkit"
59rev = "f9f0517ed6a6152c1eab36d2e71b11f38831d5e6"
5860
5961[dependencies.matrix-sdk]
6062version = "^0.6.2"
src/base.rs +16 −14
@@ -76,7 +76,7 @@ use modalkit::{
7676 tui::{
7777 buffer::Buffer,
7878 layout::{Alignment, Rect},
79 text::{Span, Spans},
79 text::{Line, Span},
8080 widgets::{Paragraph, Widget},
8181 },
8282};
@@ -174,6 +174,7 @@ pub enum CreateRoomType {
174174
175175bitflags::bitflags! {
176176 /// Available options for newly created rooms.
177 #[derive(Clone, Debug, Eq, PartialEq)]
177178 pub struct CreateRoomFlags: u32 {
178179 /// No flags specified.
179180 const NONE = 0b00000000;
@@ -188,6 +189,7 @@ bitflags::bitflags! {
188189
189190bitflags::bitflags! {
190191 /// Available options when downloading files.
192 #[derive(Clone, Debug, Eq, PartialEq)]
191193 pub struct DownloadFlags: u32 {
192194 /// No flags specified.
193195 const NONE = 0b00000000;
@@ -701,30 +703,30 @@ impl RoomInfo {
701703 }
702704 }
703705
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> {
705707 let typers = self.get_typers();
706708 let n = typers.len();
707709
708710 match n {
709 0 => Spans(vec![]),
711 0 => Line::from(vec![]),
710712 1 => {
711713 let user = settings.get_user_span(typers[0].as_ref(), self);
712714
713 Spans(vec![user, Span::from(" is typing...")])
715 Line::from(vec![user, Span::from(" is typing...")])
714716 },
715717 2 => {
716718 let user1 = settings.get_user_span(typers[0].as_ref(), self);
717719 let user2 = settings.get_user_span(typers[1].as_ref(), self);
718720
719 Spans(vec![
721 Line::from(vec![
720722 user1,
721723 Span::raw(" and "),
722724 user2,
723725 Span::from(" are typing..."),
724726 ])
725727 },
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..."),
728730 }
729731 }
730732
@@ -1364,19 +1366,19 @@ pub mod tests {
13641366
13651367 // Nothing set.
13661368 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![]));
13681370
13691371 // Empty typing list.
13701372 info.set_typing(users0);
13711373 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![]));
13731375
13741376 // Single user typing.
13751377 info.set_typing(users1);
13761378 assert!(info.users_typing.is_some());
13771379 assert_eq!(
13781380 info.get_typing_spans(&settings),
1379 Spans(vec![
1381 Line::from(vec![
13801382 Span::styled("@user1:example.com", user_style("@user1:example.com")),
13811383 Span::from(" is typing...")
13821384 ])
@@ -1387,7 +1389,7 @@ pub mod tests {
13871389 assert!(info.users_typing.is_some());
13881390 assert_eq!(
13891391 info.get_typing_spans(&settings),
1390 Spans(vec![
1392 Line::from(vec![
13911393 Span::styled("@user1:example.com", user_style("@user1:example.com")),
13921394 Span::raw(" and "),
13931395 Span::styled("@user2:example.com", user_style("@user2:example.com")),
@@ -1398,19 +1400,19 @@ pub mod tests {
13981400 // Four users typing.
13991401 info.set_typing(users4);
14001402 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..."));
14021404
14031405 // Five users typing.
14041406 info.set_typing(users5);
14051407 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..."));
14071409
14081410 // Test that USER5 gets rendered using the configured color and name.
14091411 info.set_typing(vec![TEST_USER5.clone()]);
14101412 assert!(info.users_typing.is_some());
14111413 assert_eq!(
14121414 info.get_typing_spans(&settings),
1413 Spans(vec![
1415 Line::from(vec![
14141416 Span::styled("USER 5", user_style_from_color(Color::Black)),
14151417 Span::from(" is typing...")
14161418 ])
src/message/html.rs +71 −71
@@ -29,7 +29,7 @@ use modalkit::tui::{
2929 layout::Alignment,
3030 style::{Color, Modifier as StyleModifier, Style},
3131 symbols::line,
32 text::{Span, Spans, Text},
32 text::{Line, Span, Text},
3333};
3434
3535use crate::{
@@ -151,8 +151,8 @@ impl Table {
151151 caption.print(&mut printer, style);
152152
153153 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));
156156 text.lines.push(line);
157157 }
158158 }
@@ -182,7 +182,7 @@ impl Table {
182182 ruler.push_str(line::VERTICAL_LEFT);
183183 }
184184
185 text.lines.push(Spans(vec![Span::styled(ruler, style)]));
185 text.lines.push(Line::from(vec![Span::styled(ruler, style)]));
186186
187187 let cells = cell_widths
188188 .iter()
@@ -228,7 +228,7 @@ impl Table {
228228 }
229229
230230 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)]));
232232 }
233233
234234 text
@@ -269,7 +269,7 @@ impl StyleTreeNode {
269269 child.print(&mut subp, style);
270270
271271 for mut line in subp.finish() {
272 line.0.insert(0, Span::styled(" ", style));
272 line.spans.insert(0, Span::styled(" ", style));
273273 printer.push_line(line);
274274 }
275275 },
@@ -309,7 +309,7 @@ impl StyleTreeNode {
309309 Span::styled(" ".repeat(liw), style)
310310 };
311311
312 line.0.insert(0, leading);
312 line.spans.insert(0, leading);
313313 printer.push_line(line);
314314 }
315315 }
@@ -336,8 +336,8 @@ impl StyleTreeNode {
336336 );
337337
338338 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));
341341 printer.push_line(line);
342342 }
343343
@@ -683,7 +683,7 @@ pub mod tests {
683683 let s = "<h1>Header 1</h1>";
684684 let tree = parse_matrix_html(s);
685685 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![
687687 Span::styled("#", bold),
688688 Span::styled(" ", bold),
689689 Span::styled("Header", bold),
@@ -695,7 +695,7 @@ pub mod tests {
695695 let s = "<h2>Header 2</h2>";
696696 let tree = parse_matrix_html(s);
697697 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![
699699 Span::styled("#", bold),
700700 Span::styled("#", bold),
701701 Span::styled(" ", bold),
@@ -708,7 +708,7 @@ pub mod tests {
708708 let s = "<h3>Header 3</h3>";
709709 let tree = parse_matrix_html(s);
710710 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![
712712 Span::styled("#", bold),
713713 Span::styled("#", bold),
714714 Span::styled("#", bold),
@@ -722,7 +722,7 @@ pub mod tests {
722722 let s = "<h4>Header 4</h4>";
723723 let tree = parse_matrix_html(s);
724724 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![
726726 Span::styled("#", bold),
727727 Span::styled("#", bold),
728728 Span::styled("#", bold),
@@ -737,7 +737,7 @@ pub mod tests {
737737 let s = "<h5>Header 5</h5>";
738738 let tree = parse_matrix_html(s);
739739 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![
741741 Span::styled("#", bold),
742742 Span::styled("#", bold),
743743 Span::styled("#", bold),
@@ -753,7 +753,7 @@ pub mod tests {
753753 let s = "<h6>Header 6</h6>";
754754 let tree = parse_matrix_html(s);
755755 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![
757757 Span::styled("#", bold),
758758 Span::styled("#", bold),
759759 Span::styled("#", bold),
@@ -780,7 +780,7 @@ pub mod tests {
780780 let s = "<b>Bold!</b>";
781781 let tree = parse_matrix_html(s);
782782 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![
784784 Span::styled("Bold", bold),
785785 Span::styled("!", bold),
786786 space_span(15, def)
@@ -789,7 +789,7 @@ pub mod tests {
789789 let s = "<strong>Bold!</strong>";
790790 let tree = parse_matrix_html(s);
791791 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![
793793 Span::styled("Bold", bold),
794794 Span::styled("!", bold),
795795 space_span(15, def)
@@ -798,7 +798,7 @@ pub mod tests {
798798 let s = "<i>Italic!</i>";
799799 let tree = parse_matrix_html(s);
800800 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![
802802 Span::styled("Italic", italic),
803803 Span::styled("!", italic),
804804 space_span(13, def)
@@ -807,7 +807,7 @@ pub mod tests {
807807 let s = "<em>Italic!</em>";
808808 let tree = parse_matrix_html(s);
809809 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![
811811 Span::styled("Italic", italic),
812812 Span::styled("!", italic),
813813 space_span(13, def)
@@ -816,7 +816,7 @@ pub mod tests {
816816 let s = "<del>Strikethrough!</del>";
817817 let tree = parse_matrix_html(s);
818818 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![
820820 Span::styled("Strikethrough", strike),
821821 Span::styled("!", strike),
822822 space_span(6, def)
@@ -825,7 +825,7 @@ pub mod tests {
825825 let s = "<strike>Strikethrough!</strike>";
826826 let tree = parse_matrix_html(s);
827827 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![
829829 Span::styled("Strikethrough", strike),
830830 Span::styled("!", strike),
831831 space_span(6, def)
@@ -834,7 +834,7 @@ pub mod tests {
834834 let s = "<u>Underline!</u>";
835835 let tree = parse_matrix_html(s);
836836 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![
838838 Span::styled("Underline", underl),
839839 Span::styled("!", underl),
840840 space_span(10, def)
@@ -843,7 +843,7 @@ pub mod tests {
843843 let s = "<font color=\"#ff0000\">Red!</u>";
844844 let tree = parse_matrix_html(s);
845845 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![
847847 Span::styled("Red", red),
848848 Span::styled("!", red),
849849 space_span(16, def)
@@ -852,7 +852,7 @@ pub mod tests {
852852 let s = "<font color=\"red\">Red!</u>";
853853 let tree = parse_matrix_html(s);
854854 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![
856856 Span::styled("Red", red),
857857 Span::styled("!", red),
858858 space_span(16, def)
@@ -867,22 +867,22 @@ pub mod tests {
867867 assert_eq!(text.lines.len(), 7);
868868 assert_eq!(
869869 text.lines[0],
870 Spans(vec![Span::raw("Hello"), Span::raw(" "), Span::raw(" ")])
870 Line::from(vec![Span::raw("Hello"), Span::raw(" "), Span::raw(" ")])
871871 );
872872 assert_eq!(
873873 text.lines[1],
874 Spans(vec![Span::raw("world"), Span::raw("!"), Span::raw(" ")])
874 Line::from(vec![Span::raw("world"), Span::raw("!"), Span::raw(" ")])
875875 );
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(" ")]));
879879 assert_eq!(
880880 text.lines[5],
881 Spans(vec![Span::raw("Goodbye"), Span::raw(" "), Span::raw(" ")])
881 Line::from(vec![Span::raw("Goodbye"), Span::raw(" "), Span::raw(" ")])
882882 );
883883 assert_eq!(
884884 text.lines[6],
885 Spans(vec![Span::raw("world"), Span::raw("!"), Span::raw(" ")])
885 Line::from(vec![Span::raw("world"), Span::raw("!"), Span::raw(" ")])
886886 );
887887 }
888888
@@ -894,11 +894,11 @@ pub mod tests {
894894 assert_eq!(text.lines.len(), 2);
895895 assert_eq!(
896896 text.lines[0],
897 Spans(vec![Span::raw(" "), Span::raw("Hello"), Span::raw(" ")])
897 Line::from(vec![Span::raw(" "), Span::raw("Hello"), Span::raw(" ")])
898898 );
899899 assert_eq!(
900900 text.lines[1],
901 Spans(vec![Span::raw(" "), Span::raw("world"), Span::raw("!")])
901 Line::from(vec![Span::raw(" "), Span::raw("world"), Span::raw("!")])
902902 );
903903 }
904904
@@ -910,7 +910,7 @@ pub mod tests {
910910 assert_eq!(text.lines.len(), 6);
911911 assert_eq!(
912912 text.lines[0],
913 Spans(vec![
913 Line::from(vec![
914914 Span::raw("- "),
915915 Span::raw("List"),
916916 Span::raw(" "),
@@ -919,7 +919,7 @@ pub mod tests {
919919 );
920920 assert_eq!(
921921 text.lines[1],
922 Spans(vec![
922 Line::from(vec![
923923 Span::raw(" "),
924924 Span::raw("Item"),
925925 Span::raw(" "),
@@ -928,7 +928,7 @@ pub mod tests {
928928 );
929929 assert_eq!(
930930 text.lines[2],
931 Spans(vec![
931 Line::from(vec![
932932 Span::raw("- "),
933933 Span::raw("List"),
934934 Span::raw(" "),
@@ -937,7 +937,7 @@ pub mod tests {
937937 );
938938 assert_eq!(
939939 text.lines[3],
940 Spans(vec![
940 Line::from(vec![
941941 Span::raw(" "),
942942 Span::raw("Item"),
943943 Span::raw(" "),
@@ -946,7 +946,7 @@ pub mod tests {
946946 );
947947 assert_eq!(
948948 text.lines[4],
949 Spans(vec![
949 Line::from(vec![
950950 Span::raw("- "),
951951 Span::raw("List"),
952952 Span::raw(" "),
@@ -955,7 +955,7 @@ pub mod tests {
955955 );
956956 assert_eq!(
957957 text.lines[5],
958 Spans(vec![
958 Line::from(vec![
959959 Span::raw(" "),
960960 Span::raw("Item"),
961961 Span::raw(" "),
@@ -972,7 +972,7 @@ pub mod tests {
972972 assert_eq!(text.lines.len(), 6);
973973 assert_eq!(
974974 text.lines[0],
975 Spans(vec![
975 Line::from(vec![
976976 Span::raw("1. "),
977977 Span::raw("List"),
978978 Span::raw(" "),
@@ -981,7 +981,7 @@ pub mod tests {
981981 );
982982 assert_eq!(
983983 text.lines[1],
984 Spans(vec![
984 Line::from(vec![
985985 Span::raw(" "),
986986 Span::raw("Item"),
987987 Span::raw(" "),
@@ -990,7 +990,7 @@ pub mod tests {
990990 );
991991 assert_eq!(
992992 text.lines[2],
993 Spans(vec![
993 Line::from(vec![
994994 Span::raw("2. "),
995995 Span::raw("List"),
996996 Span::raw(" "),
@@ -999,7 +999,7 @@ pub mod tests {
999999 );
10001000 assert_eq!(
10011001 text.lines[3],
1002 Spans(vec![
1002 Line::from(vec![
10031003 Span::raw(" "),
10041004 Span::raw("Item"),
10051005 Span::raw(" "),
@@ -1008,7 +1008,7 @@ pub mod tests {
10081008 );
10091009 assert_eq!(
10101010 text.lines[4],
1011 Spans(vec![
1011 Line::from(vec![
10121012 Span::raw("3. "),
10131013 Span::raw("List"),
10141014 Span::raw(" "),
@@ -1017,7 +1017,7 @@ pub mod tests {
10171017 );
10181018 assert_eq!(
10191019 text.lines[5],
1020 Spans(vec![
1020 Line::from(vec![
10211021 Span::raw(" "),
10221022 Span::raw("Item"),
10231023 Span::raw(" "),
@@ -1043,8 +1043,8 @@ pub mod tests {
10431043 assert_eq!(text.lines.len(), 11);
10441044
10451045 // 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![
10481048 Span::raw("│"),
10491049 Span::styled("Colu", bold),
10501050 Span::raw("│"),
@@ -1053,7 +1053,7 @@ pub mod tests {
10531053 Span::styled("Col", bold),
10541054 Span::raw("│")
10551055 ]);
1056 assert_eq!(text.lines[2].0, vec![
1056 assert_eq!(text.lines[2].spans, vec![
10571057 Span::raw("│"),
10581058 Span::styled("mn", bold),
10591059 Span::styled(" ", bold),
@@ -1066,7 +1066,7 @@ pub mod tests {
10661066 Span::styled("umn", bold),
10671067 Span::raw("│")
10681068 ]);
1069 assert_eq!(text.lines[3].0, vec![
1069 assert_eq!(text.lines[3].spans, vec![
10701070 Span::raw("│"),
10711071 Span::raw(" "),
10721072 Span::raw("│"),
@@ -1078,8 +1078,8 @@ pub mod tests {
10781078 ]);
10791079
10801080 // 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![
10831083 Span::raw("│"),
10841084 Span::raw("a"),
10851085 Span::raw(" "),
@@ -1093,8 +1093,8 @@ pub mod tests {
10931093 ]);
10941094
10951095 // 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![
10981098 Span::raw("│"),
10991099 Span::raw("a"),
11001100 Span::raw(" "),
@@ -1108,8 +1108,8 @@ pub mod tests {
11081108 ]);
11091109
11101110 // 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![
11131113 Span::raw("│"),
11141114 Span::raw("a"),
11151115 Span::raw(" "),
@@ -1123,7 +1123,7 @@ pub mod tests {
11231123 ]);
11241124
11251125 // Bottom ruler
1126 assert_eq!(text.lines[10].0, vec![Span::raw("└────┴────┴───┘")]);
1126 assert_eq!(text.lines[10].spans, vec![Span::raw("└────┴────┴───┘")]);
11271127 }
11281128
11291129 #[test]
@@ -1135,7 +1135,7 @@ pub mod tests {
11351135 assert_eq!(text.lines.len(), 4);
11361136 assert_eq!(
11371137 text.lines[0],
1138 Spans(vec![
1138 Line::from(vec![
11391139 Span::raw("This"),
11401140 Span::raw(" "),
11411141 Span::raw("was"),
@@ -1145,11 +1145,11 @@ pub mod tests {
11451145 );
11461146 assert_eq!(
11471147 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")])
11491149 );
11501150 assert_eq!(
11511151 text.lines[2],
1152 Spans(vec![
1152 Line::from(vec![
11531153 Span::raw("This"),
11541154 Span::raw(" "),
11551155 Span::raw("is"),
@@ -1159,7 +1159,7 @@ pub mod tests {
11591159 );
11601160 assert_eq!(
11611161 text.lines[3],
1162 Spans(vec![
1162 Line::from(vec![
11631163 Span::raw("the"),
11641164 Span::raw(" "),
11651165 Span::raw("reply"),
@@ -1172,7 +1172,7 @@ pub mod tests {
11721172 assert_eq!(text.lines.len(), 2);
11731173 assert_eq!(
11741174 text.lines[0],
1175 Spans(vec![
1175 Line::from(vec![
11761176 Span::raw("This"),
11771177 Span::raw(" "),
11781178 Span::raw("is"),
@@ -1182,7 +1182,7 @@ pub mod tests {
11821182 );
11831183 assert_eq!(
11841184 text.lines[1],
1185 Spans(vec![
1185 Line::from(vec![
11861186 Span::raw("the"),
11871187 Span::raw(" "),
11881188 Span::raw("reply"),
@@ -1197,9 +1197,9 @@ pub mod tests {
11971197 let tree = parse_matrix_html(s);
11981198 let text = tree.to_text(7, Style::default(), true);
11991199 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")]),);
12031203 }
12041204
12051205 #[test]
@@ -1210,7 +1210,7 @@ pub mod tests {
12101210 assert_eq!(text.lines.len(), 1);
12111211 assert_eq!(
12121212 text.lines[0],
1213 Spans(vec![
1213 Line::from(vec![
12141214 Span::raw("Hello"),
12151215 Span::raw(" "),
12161216 Span::raw("World"),
@@ -1233,7 +1233,7 @@ pub mod tests {
12331233 assert_eq!(text.lines.len(), 5);
12341234 assert_eq!(
12351235 text.lines[0],
1236 Spans(vec![
1236 Line::from(vec![
12371237 Span::raw(line::TOP_LEFT),
12381238 Span::raw(line::HORIZONTAL.repeat(23)),
12391239 Span::raw(line::TOP_RIGHT)
@@ -1241,7 +1241,7 @@ pub mod tests {
12411241 );
12421242 assert_eq!(
12431243 text.lines[1],
1244 Spans(vec![
1244 Line::from(vec![
12451245 Span::raw(line::VERTICAL),
12461246 Span::raw("fn"),
12471247 Span::raw(" "),
@@ -1261,7 +1261,7 @@ pub mod tests {
12611261 );
12621262 assert_eq!(
12631263 text.lines[2],
1264 Spans(vec![
1264 Line::from(vec![
12651265 Span::raw(line::VERTICAL),
12661266 Span::raw(" "),
12671267 Span::raw("return"),
@@ -1274,7 +1274,7 @@ pub mod tests {
12741274 );
12751275 assert_eq!(
12761276 text.lines[3],
1277 Spans(vec![
1277 Line::from(vec![
12781278 Span::raw(line::VERTICAL),
12791279 Span::raw("}"),
12801280 Span::raw(" ".repeat(22)),
@@ -1283,7 +1283,7 @@ pub mod tests {
12831283 );
12841284 assert_eq!(
12851285 text.lines[4],
1286 Spans(vec![
1286 Line::from(vec![
12871287 Span::raw(line::BOTTOM_LEFT),
12881288 Span::raw(line::HORIZONTAL.repeat(23)),
12891289 Span::raw(line::BOTTOM_RIGHT)
src/message/mod.rs +17 −15
@@ -47,7 +47,7 @@ use matrix_sdk::ruma::{
4747use modalkit::tui::{
4848 style::{Modifier as StyleModifier, Style},
4949 symbols::line::THICK_VERTICAL,
50 text::{Span, Spans, Text},
50 text::{Line, Span, Text},
5151};
5252
5353use modalkit::editing::{base::ViewportContext, cursor::Cursor};
@@ -74,6 +74,7 @@ const fn span_static(s: &'static str) -> Span<'static> {
7474 bg: None,
7575 add_modifier: StyleModifier::empty(),
7676 sub_modifier: StyleModifier::empty(),
77 underline_color: None,
7778 },
7879 }
7980}
@@ -83,6 +84,7 @@ const BOLD_STYLE: Style = Style {
8384 bg: None,
8485 add_modifier: StyleModifier::BOLD,
8586 sub_modifier: StyleModifier::empty(),
87 underline_color: None,
8688};
8789
8890const USER_GUTTER: usize = 30;
@@ -508,14 +510,14 @@ impl<'a> MessageFormatter<'a> {
508510 }
509511
510512 #[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>) {
512514 if let Some(date) = self.date.take() {
513515 let len = date.content.as_ref().len();
514516 let padding = self.orig.saturating_sub(len);
515517 let leading = space_span(padding / 2, Style::default());
516518 let trailing = space_span(padding.saturating_sub(padding / 2), Style::default());
517519
518 text.lines.push(Spans(vec![leading, date, trailing]));
520 text.lines.push(Line::from(vec![leading, date, trailing]));
519521 }
520522
521523 match self.cols {
@@ -525,7 +527,7 @@ impl<'a> MessageFormatter<'a> {
525527 let time = self.time.take().unwrap_or(TIME_GUTTER_EMPTY_SPAN);
526528
527529 let mut line = vec![user];
528 line.extend(spans.0);
530 line.extend(prev_line.spans);
529531 line.push(time);
530532
531533 // Show read receipts.
@@ -542,35 +544,35 @@ impl<'a> MessageFormatter<'a> {
542544 line.push(a);
543545 line.push(Span::raw(" "));
544546
545 text.lines.push(Spans(line))
547 text.lines.push(Line::from(line))
546548 },
547549 MessageColumns::Three => {
548550 let user = self.user.take().unwrap_or(USER_GUTTER_EMPTY_SPAN);
549551 let time = self.time.take().unwrap_or_else(|| Span::from(""));
550552
551553 let mut line = vec![user];
552 line.extend(spans.0);
554 line.extend(prev_line.spans);
553555 line.push(time);
554556
555 text.lines.push(Spans(line))
557 text.lines.push(Line::from(line))
556558 },
557559 MessageColumns::Two => {
558560 let user = self.user.take().unwrap_or(USER_GUTTER_EMPTY_SPAN);
559561 let mut line = vec![user];
560 line.extend(spans.0);
562 line.extend(prev_line.spans);
561563
562 text.lines.push(Spans(line));
564 text.lines.push(Line::from(line));
563565 },
564566 MessageColumns::One => {
565567 if let Some(user) = self.user.take() {
566 text.lines.push(Spans(vec![user]));
568 text.lines.push(Line::from(vec![user]));
567569 }
568570
569571 let leading = space_span(2, style);
570572 let mut line = vec![leading];
571 line.extend(spans.0);
573 line.extend(prev_line.spans);
572574
573 text.lines.push(Spans(line));
575 text.lines.push(Line::from(line));
574576 },
575577 }
576578 }
@@ -709,7 +711,7 @@ impl Message {
709711 sender.style = sender.style.patch(style);
710712
711713 fmt.push_spans(
712 Spans(vec![
714 Line::from(vec![
713715 Span::styled(" ", style),
714716 Span::styled(THICK_VERTICAL, style),
715717 sender,
@@ -721,8 +723,8 @@ impl Message {
721723 );
722724
723725 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));
726728 }
727729
728730 fmt.push_text(replied, style, &mut text);
src/message/printer.rs +5 −5
@@ -7,7 +7,7 @@ use std::borrow::Cow;
77
88use modalkit::tui::layout::Alignment;
99use modalkit::tui::style::Style;
10use modalkit::tui::text::{Span, Spans, Text};
10use modalkit::tui::text::{Line, Span, Text};
1111use unicode_segmentation::UnicodeSegmentation;
1212use unicode_width::UnicodeWidthStr;
1313
@@ -92,7 +92,7 @@ impl<'a> TextPrinter<'a> {
9292
9393 fn push(&mut self) {
9494 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)));
9696 }
9797
9898 /// Start a new line.
@@ -228,10 +228,10 @@ impl<'a> TextPrinter<'a> {
228228 }
229229 }
230230
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>) {
233233 self.commit();
234 self.text.lines.push(spans);
234 self.text.lines.push(line);
235235 }
236236
237237 /// Push multiline [Text] into the printer.
src/util.rs +9 −7
@@ -5,7 +5,7 @@ use unicode_segmentation::UnicodeSegmentation;
55use unicode_width::UnicodeWidthStr;
66
77use modalkit::tui::style::Style;
8use modalkit::tui::text::{Span, Spans, Text};
8use modalkit::tui::text::{Line, Span, Text};
99
1010pub fn split_cow(cow: Cow<'_, str>, idx: usize) -> (Cow<'_, str>, Cow<'_, str>) {
1111 match cow {
@@ -106,7 +106,7 @@ where
106106
107107 for (line, w) in wrap(s, width) {
108108 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]);
110110
111111 text.lines.push(spans);
112112 }
@@ -128,17 +128,19 @@ pub fn space_text(width: usize, style: Style) -> Text<'static> {
128128
129129pub fn join_cell_text<'a>(texts: Vec<(Text<'a>, usize)>, join: Span<'a>, style: Style) -> Text<'a> {
130130 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 };
132134
133135 for (mut t, w) in texts.into_iter() {
134136 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);
137139 } else {
138 text.lines[i].0.push(space_span(w, style));
140 text.lines[i].spans.push(space_span(w, style));
139141 }
140142
141 text.lines[i].0.push(join.clone());
143 text.lines[i].spans.push(join.clone());
142144 }
143145 }
144146
src/windows/mod.rs +28 −28
@@ -26,7 +26,7 @@ use modalkit::tui::{
2626 buffer::Buffer,
2727 layout::{Alignment, Rect},
2828 style::{Modifier as StyleModifier, Style},
29 text::{Span, Spans, Text},
29 text::{Line, Span, Text},
3030 widgets::StatefulWidget,
3131};
3232
@@ -102,7 +102,7 @@ fn bold_span(s: &str) -> Span {
102102}
103103
104104#[inline]
105fn bold_spans(s: &str) -> Spans {
105fn bold_spans(s: &str) -> Line {
106106 bold_span(s).into()
107107}
108108
@@ -537,7 +537,7 @@ impl Window<IambInfo> for IambWindow {
537537 }
538538 }
539539
540 fn get_tab_title(&self, store: &mut ProgramStore) -> Spans {
540 fn get_tab_title(&self, store: &mut ProgramStore) -> Line {
541541 match self {
542542 IambWindow::DirectList(_) => bold_spans("Direct Messages"),
543543 IambWindow::RoomList(_) => bold_spans("Rooms"),
@@ -548,7 +548,7 @@ impl Window<IambInfo> for IambWindow {
548548 IambWindow::Room(w) => {
549549 let title = store.application.get_room_title(w.id());
550550
551 Spans::from(title)
551 Line::from(title)
552552 },
553553 IambWindow::MemberList(state, room_id, _) => {
554554 let title = store.application.get_room_title(room_id.as_ref());
@@ -558,12 +558,12 @@ impl Window<IambInfo> for IambWindow {
558558 Span::styled(format!("({n}): "), bold_style()),
559559 title.into(),
560560 ];
561 Spans(v)
561 Line::from(v)
562562 },
563563 }
564564 }
565565
566 fn get_win_title(&self, store: &mut ProgramStore) -> Spans {
566 fn get_win_title(&self, store: &mut ProgramStore) -> Line {
567567 match self {
568568 IambWindow::DirectList(_) => bold_spans("Direct Messages"),
569569 IambWindow::RoomList(_) => bold_spans("Rooms"),
@@ -580,7 +580,7 @@ impl Window<IambInfo> for IambWindow {
580580 Span::styled(format!("({n}): "), bold_style()),
581581 title.into(),
582582 ];
583 Spans(v)
583 Line::from(v)
584584 },
585585 }
586586 }
@@ -730,7 +730,7 @@ impl ListItem<IambInfo> for RoomItem {
730730
731731 append_tags(tags, &mut spans, style);
732732
733 Text::from(Spans(spans))
733 Text::from(Line::from(spans))
734734 } else {
735735 selected_text(self.name.as_str(), selected)
736736 }
@@ -796,7 +796,7 @@ impl ListItem<IambInfo> for DirectItem {
796796
797797 append_tags(tags, &mut spans, style);
798798
799 Text::from(Spans(spans))
799 Text::from(Line::from(spans))
800800 } else {
801801 selected_text(self.name.as_str(), selected)
802802 }
@@ -1023,47 +1023,47 @@ impl ListItem<IambInfo> for VerifyItem {
10231023
10241024 let bold = Style::default().add_modifier(StyleModifier::BOLD);
10251025 let item = Span::styled(self.show_item(), selected_style(selected));
1026 lines.push(Spans::from(item));
1026 lines.push(Line::from(item));
10271027
10281028 if self.sasv1.is_done() {
10291029 // Print nothing.
10301030 } else if self.sasv1.is_cancelled() {
10311031 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(""));
10341034 }
10351035
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:"));
10371037 } else if let Some(emoji) = self.sasv1.emoji() {
1038 lines.push(Spans::from(
1038 lines.push(Line::from(
10391039 " Both devices should see the following Emoji sequence:".to_string(),
10401040 ));
1041 lines.push(Spans::from(""));
1041 lines.push(Line::from(""));
10421042
10431043 for line in format_emojis(emoji).lines() {
1044 lines.push(Spans::from(format!(" {line}")));
1044 lines.push(Line::from(format!(" {line}")));
10451045 }
10461046
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(
10511051 format!(":verify mismatch {}", self.user_dev),
10521052 bold,
10531053 )));
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:"));
10561056 } else {
1057 lines.push(Spans::from(" To accept this request, run:"));
1057 lines.push(Line::from(" To accept this request, run:"));
10581058 }
10591059
10601060 let cmd = self.to_string();
10611061
10621062 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![
10671067 Span::from("You can copy the above command with "),
10681068 Span::styled("yy", bold),
10691069 Span::from(" and then execute it with "),
@@ -1167,7 +1167,7 @@ impl ListItem<IambInfo> for MemberItem {
11671167
11681168 spans.extend(state);
11691169
1170 return Spans(spans).into();
1170 return Line::from(spans).into();
11711171 }
11721172
11731173 fn get_word(&self) -> Option<String> {
src/windows/room/chat.rs +3 −3
@@ -35,7 +35,7 @@ use modalkit::{
3535 tui::{
3636 buffer::Buffer,
3737 layout::Rect,
38 text::{Span, Spans},
38 text::{Line, Span},
3939 widgets::{Paragraph, StatefulWidget, Widget},
4040 },
4141 widgets::textbox::{TextBox, TextBoxState},
@@ -812,7 +812,7 @@ impl<'a> StatefulWidget for Chat<'a> {
812812 // Determine whether we have a description to show for the message bar.
813813 let desc_spans = match (&state.editing, &state.reply_to) {
814814 (None, None) => None,
815 (Some(_), None) => Some(Spans::from("Editing message")),
815 (Some(_), None) => Some(Line::from("Editing message")),
816816 (editing, Some(_)) => {
817817 state.reply_to.as_ref().and_then(|k| {
818818 let room = self.store.application.rooms.get(state.id())?;
@@ -824,7 +824,7 @@ impl<'a> StatefulWidget for Chat<'a> {
824824 } else {
825825 Span::from("Replying to ")
826826 };
827 let spans = Spans(vec![prefix, user]);
827 let spans = Line::from(vec![prefix, user]);
828828
829829 spans.into()
830830 })
src/windows/room/mod.rs +5 −5
@@ -15,7 +15,7 @@ use modalkit::tui::{
1515 buffer::Buffer,
1616 layout::{Alignment, Rect},
1717 style::{Modifier as StyleModifier, Style},
18 text::{Span, Spans, Text},
18 text::{Line, Span, Text},
1919 widgets::{Paragraph, StatefulWidget, Widget},
2020};
2121
@@ -150,8 +150,8 @@ impl RoomState {
150150 invited.push(store.application.settings.get_user_span(inviter.user_id(), info));
151151 }
152152
153 let l1 = Spans(invited);
154 let l2 = Spans::from(
153 let l1 = Line::from(invited);
154 let l2 = Line::from(
155155 "You can run `:invite accept` or `:invite reject` to accept or reject this invitation.",
156156 );
157157 let text = Text { lines: vec![l1, l2] };
@@ -305,7 +305,7 @@ impl RoomState {
305305 }
306306 }
307307
308 pub fn get_title(&self, store: &mut ProgramStore) -> Spans {
308 pub fn get_title(&self, store: &mut ProgramStore) -> Line {
309309 let title = store.application.get_room_title(self.id());
310310 let style = Style::default().add_modifier(StyleModifier::BOLD);
311311 let mut spans = vec![Span::styled(title, style)];
@@ -319,7 +319,7 @@ impl RoomState {
319319 _ => {},
320320 }
321321
322 Spans(spans)
322 Line::from(spans)
323323 }
324324
325325 pub fn focus_toggle(&mut self) {
src/windows/room/scrollback.rs +3 −3
@@ -9,7 +9,7 @@ use modalkit::tui::{
99 buffer::Buffer,
1010 layout::{Alignment, Rect},
1111 style::{Modifier as StyleModifier, Style},
12 text::{Span, Spans},
12 text::{Line, Span},
1313 widgets::{Paragraph, StatefulWidget, Widget},
1414};
1515use modalkit::widgets::{ScrollActions, TerminalCursor, WindowOps};
@@ -1226,7 +1226,7 @@ fn render_jump_to_recent(area: Rect, buf: &mut Buffer, focused: bool) -> Rect {
12261226 Span::raw(" to jump to latest message"),
12271227 ];
12281228
1229 Paragraph::new(Spans::from(msg))
1229 Paragraph::new(Line::from(msg))
12301230 .alignment(Alignment::Center)
12311231 .render(bar, buf);
12321232
@@ -1342,7 +1342,7 @@ impl<'a> StatefulWidget for Scrollback<'a> {
13421342 let x = area.left();
13431343
13441344 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);
13461346
13471347 y += 1;
13481348 }
src/windows/room/space.rs +2 −2
@@ -11,7 +11,7 @@ use modalkit::tui::{
1111 buffer::Buffer,
1212 layout::Rect,
1313 style::{Color, Style},
14 text::{Span, Spans, Text},
14 text::{Line, Span, Text},
1515 widgets::StatefulWidget,
1616};
1717
@@ -140,7 +140,7 @@ impl<'a> StatefulWidget for Space<'a> {
140140 },
141141 Err(e) => {
142142 let lines = vec![
143 Spans::from("Unable to fetch space room hierarchy:"),
143 Line::from("Unable to fetch space room hierarchy:"),
144144 Span::styled(e.to_string(), Style::default().fg(Color::Red)).into(),
145145 ];
146146