Skip to content

Commit 4f3be69

Browse files
committed
upgrade ratatui
1 parent 195a6f2 commit 4f3be69

21 files changed

+134
-123
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ log = "0.4"
4040
notify = "5.1"
4141
notify-debouncer-mini = "0.2"
4242
once_cell = "1"
43-
ratatui = { version = "0.20", default-features = false, features = ['crossterm', 'serde'] }
43+
ratatui = { version = "0.21", default-features = false, features = ['crossterm', 'serde'] }
4444
rayon-core = "1.11"
4545
ron = "0.8"
4646
scopeguard = "1.1"

src/app.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use ratatui::{
3939
layout::{
4040
Alignment, Constraint, Direction, Layout, Margin, Rect,
4141
},
42-
text::{Span, Spans},
42+
text::{Line, Span},
4343
widgets::{Block, Borders, Paragraph, Tabs},
4444
Frame,
4545
};
@@ -1189,7 +1189,7 @@ impl App {
11891189
let table_area = r; // use entire area to allow drawing the horizontal separator line
11901190
let text_area = left_right[1];
11911191

1192-
let tabs = tab_labels.into_iter().map(Spans::from).collect();
1192+
let tabs = tab_labels.into_iter().map(Line::from).collect();
11931193

11941194
f.render_widget(
11951195
Tabs::new(tabs)
@@ -1206,7 +1206,7 @@ impl App {
12061206
);
12071207

12081208
f.render_widget(
1209-
Paragraph::new(Spans::from(vec![Span::styled(
1209+
Paragraph::new(Line::from(vec![Span::styled(
12101210
ellipsis_trim_start(
12111211
&self.repo_path_text,
12121212
text_area.width as usize,

src/cmdbar.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{
55
use ratatui::{
66
backend::Backend,
77
layout::{Alignment, Rect},
8-
text::{Span, Spans},
8+
text::{Line, Span},
99
widgets::Paragraph,
1010
Frame,
1111
};
@@ -151,7 +151,7 @@ impl CommandBar {
151151
.draw_list
152152
.split(|c| matches!(c, DrawListEntry::LineBreak))
153153
.map(|c_arr| {
154-
Spans::from(
154+
Line::from(
155155
c_arr
156156
.iter()
157157
.map(|c| match c {
@@ -174,7 +174,7 @@ impl CommandBar {
174174
.collect::<Vec<Span>>(),
175175
)
176176
})
177-
.collect::<Vec<Spans>>();
177+
.collect::<Vec<Line>>();
178178

179179
f.render_widget(
180180
Paragraph::new(texts).alignment(Alignment::Left),
@@ -190,7 +190,7 @@ impl CommandBar {
190190
);
191191

192192
f.render_widget(
193-
Paragraph::new(Spans::from(vec![Span::raw(
193+
Paragraph::new(Line::from(vec![Span::raw(
194194
Cow::from(if self.expanded {
195195
"less [.]"
196196
} else {

src/components/branch_find_popup.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use fuzzy_matcher::FuzzyMatcher;
1515
use ratatui::{
1616
backend::Backend,
1717
layout::{Constraint, Direction, Layout, Margin, Rect},
18-
text::{Span, Spans},
18+
text::{Line, Span},
1919
widgets::{Block, Borders, Clear},
2020
Frame,
2121
};
@@ -233,7 +233,7 @@ impl DrawableComponent for BranchFindPopup {
233233
&self.branches[*idx],
234234
width,
235235
);
236-
Spans::from(
236+
Line::from(
237237
full_text
238238
.char_indices()
239239
.map(|(c_idx, c)| {

src/components/branchlist.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use ratatui::{
3131
layout::{
3232
Alignment, Constraint, Direction, Layout, Margin, Rect,
3333
},
34-
text::{Span, Spans, Text},
34+
text::{Line, Span, Text},
3535
widgets::{Block, BorderType, Borders, Clear, Paragraph, Tabs},
3636
Frame,
3737
};
@@ -661,7 +661,7 @@ impl BranchListComponent {
661661
theme.branch(selected, is_head),
662662
);
663663

664-
txt.push(Spans::from(vec![
664+
txt.push(Line::from(vec![
665665
span_prefix,
666666
span_name,
667667
span_hash,
@@ -702,7 +702,7 @@ impl BranchListComponent {
702702
let tabs = [Span::raw("Local"), Span::raw("Remote")]
703703
.iter()
704704
.cloned()
705-
.map(Spans::from)
705+
.map(Line::from)
706706
.collect();
707707

708708
f.render_widget(

src/components/commit_details/compare_details.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crossterm::event::Event;
1717
use ratatui::{
1818
backend::Backend,
1919
layout::{Constraint, Direction, Layout, Rect},
20-
text::{Span, Spans, Text},
20+
text::{Line, Span, Text},
2121
Frame,
2222
};
2323

@@ -65,9 +65,9 @@ impl CompareDetailsComponent {
6565
}
6666

6767
#[allow(unstable_name_collisions)]
68-
fn get_commit_text(&self, data: &CommitDetails) -> Vec<Spans> {
68+
fn get_commit_text(&self, data: &CommitDetails) -> Vec<Line> {
6969
let mut res = vec![
70-
Spans::from(vec![
70+
Line::from(vec![
7171
style_detail(&self.theme, &Detail::Author),
7272
Span::styled(
7373
Cow::from(format!(
@@ -77,7 +77,7 @@ impl CompareDetailsComponent {
7777
self.theme.text(true, false),
7878
),
7979
]),
80-
Spans::from(vec![
80+
Line::from(vec![
8181
style_detail(&self.theme, &Detail::Date),
8282
Span::styled(
8383
Cow::from(time_to_string(
@@ -89,7 +89,7 @@ impl CompareDetailsComponent {
8989
]),
9090
];
9191

92-
res.push(Spans::from(vec![
92+
res.push(Line::from(vec![
9393
style_detail(&self.theme, &Detail::Message),
9494
Span::styled(
9595
Cow::from(

src/components/commit_details/details.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use ratatui::{
1919
backend::Backend,
2020
layout::{Constraint, Direction, Layout, Rect},
2121
style::{Modifier, Style},
22-
text::{Span, Spans, Text},
22+
text::{Line, Span, Text},
2323
Frame,
2424
};
2525
use std::clone::Clone;
@@ -133,7 +133,7 @@ impl DetailsComponent {
133133
&self,
134134
width: usize,
135135
height: usize,
136-
) -> Vec<Spans> {
136+
) -> Vec<Line> {
137137
let (wrapped_title, wrapped_message) =
138138
Self::get_wrapped_lines(&self.data, width);
139139

@@ -144,7 +144,7 @@ impl DetailsComponent {
144144
.skip(self.scroll.get_top())
145145
.take(height)
146146
.map(|(i, line)| {
147-
Spans::from(vec![Span::styled(
147+
Line::from(vec![Span::styled(
148148
line.clone(),
149149
self.get_theme_for_line(i < wrapped_title.len()),
150150
)])
@@ -153,10 +153,10 @@ impl DetailsComponent {
153153
}
154154

155155
#[allow(unstable_name_collisions, clippy::too_many_lines)]
156-
fn get_text_info(&self) -> Vec<Spans> {
156+
fn get_text_info(&self) -> Vec<Line> {
157157
self.data.as_ref().map_or_else(Vec::new, |data| {
158158
let mut res = vec![
159-
Spans::from(vec![
159+
Line::from(vec![
160160
style_detail(&self.theme, &Detail::Author),
161161
Span::styled(
162162
Cow::from(format!(
@@ -166,7 +166,7 @@ impl DetailsComponent {
166166
self.theme.text(true, false),
167167
),
168168
]),
169-
Spans::from(vec![
169+
Line::from(vec![
170170
style_detail(&self.theme, &Detail::Date),
171171
Span::styled(
172172
Cow::from(time_to_string(
@@ -180,7 +180,7 @@ impl DetailsComponent {
180180

181181
if let Some(ref committer) = data.committer {
182182
res.extend(vec![
183-
Spans::from(vec![
183+
Line::from(vec![
184184
style_detail(&self.theme, &Detail::Commiter),
185185
Span::styled(
186186
Cow::from(format!(
@@ -190,7 +190,7 @@ impl DetailsComponent {
190190
self.theme.text(true, false),
191191
),
192192
]),
193-
Spans::from(vec![
193+
Line::from(vec![
194194
style_detail(&self.theme, &Detail::Date),
195195
Span::styled(
196196
Cow::from(time_to_string(
@@ -203,7 +203,7 @@ impl DetailsComponent {
203203
]);
204204
}
205205

206-
res.push(Spans::from(vec![
206+
res.push(Line::from(vec![
207207
Span::styled(
208208
Cow::from(strings::commit::details_sha()),
209209
self.theme.text(false, false),
@@ -215,12 +215,12 @@ impl DetailsComponent {
215215
]));
216216

217217
if !self.tags.is_empty() {
218-
res.push(Spans::from(style_detail(
218+
res.push(Line::from(style_detail(
219219
&self.theme,
220220
&Detail::Sha,
221221
)));
222222

223-
res.push(Spans::from(
223+
res.push(Line::from(
224224
itertools::Itertools::intersperse(
225225
self.tags.iter().map(|tag| {
226226
Span::styled(

src/components/commitlist.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use itertools::Itertools;
2222
use ratatui::{
2323
backend::Backend,
2424
layout::{Alignment, Rect},
25-
text::{Span, Spans},
25+
text::{Line, Span},
2626
widgets::{Block, Borders, Paragraph},
2727
Frame,
2828
};
@@ -306,7 +306,7 @@ impl CommitList {
306306
width: usize,
307307
now: DateTime<Local>,
308308
marked: Option<bool>,
309-
) -> Spans<'a> {
309+
) -> Line<'a> {
310310
let mut txt: Vec<Span> = Vec::with_capacity(
311311
ELEMENTS_PER_LINE + if marked.is_some() { 2 } else { 0 },
312312
);
@@ -390,13 +390,13 @@ impl CommitList {
390390
theme.text(true, selected),
391391
));
392392

393-
Spans::from(txt)
393+
Line::from(txt)
394394
}
395395

396-
fn get_text(&self, height: usize, width: usize) -> Vec<Spans> {
396+
fn get_text(&self, height: usize, width: usize) -> Vec<Line> {
397397
let selection = self.relative_selection();
398398

399-
let mut txt: Vec<Spans> = Vec::with_capacity(height);
399+
let mut txt: Vec<Line> = Vec::with_capacity(height);
400400

401401
let now = Local::now();
402402

src/components/diff.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use ratatui::{
2424
backend::Backend,
2525
layout::Rect,
2626
symbols,
27-
text::{Span, Spans},
27+
text::{Line, Span},
2828
widgets::{Block, Borders, Paragraph},
2929
Frame,
3030
};
@@ -330,15 +330,15 @@ impl DiffComponent {
330330
None
331331
}
332332

333-
fn get_text(&self, width: u16, height: u16) -> Vec<Spans> {
334-
let mut res: Vec<Spans> = Vec::new();
333+
fn get_text(&self, width: u16, height: u16) -> Vec<Line> {
334+
let mut res: Vec<Line> = Vec::new();
335335
if let Some(diff) = &self.diff {
336336
if diff.hunks.is_empty() {
337337
let is_positive = diff.size_delta >= 0;
338338
let delta_byte_size =
339339
ByteSize::b(diff.size_delta.unsigned_abs());
340340
let sign = if is_positive { "+" } else { "-" };
341-
res.extend(vec![Spans::from(vec![
341+
res.extend(vec![Line::from(vec![
342342
Span::raw(Cow::from("size: ")),
343343
Span::styled(
344344
Cow::from(format!(
@@ -435,7 +435,7 @@ impl DiffComponent {
435435
end_of_hunk: bool,
436436
theme: &SharedTheme,
437437
scrolled_right: usize,
438-
) -> Spans<'a> {
438+
) -> Line<'a> {
439439
let style = theme.diff_hunk_marker(selected_hunk);
440440

441441
let left_side_of_line = if end_of_hunk {
@@ -465,7 +465,7 @@ impl DiffComponent {
465465
format!("{content}\n")
466466
};
467467

468-
Spans::from(vec![
468+
Line::from(vec![
469469
left_side_of_line,
470470
Span::styled(
471471
Cow::from(filled),
@@ -666,7 +666,7 @@ impl DrawableComponent for DiffComponent {
666666
);
667667

668668
let txt = if self.pending {
669-
vec![Spans::from(vec![Span::styled(
669+
vec![Line::from(vec![Span::styled(
670670
Cow::from(strings::loading_text(&self.key_config)),
671671
self.theme.text(false, false),
672672
)])]

0 commit comments

Comments
 (0)