Skip to content

Commit 1b90436

Browse files
author
Stephan Dilly
committed
switch to tui clear new in 0.9
1 parent 7a479b1 commit 1b90436

File tree

6 files changed

+39
-67
lines changed

6 files changed

+39
-67
lines changed

src/components/commit.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use tui::{
1717
backend::Backend,
1818
layout::{Alignment, Rect},
1919
style::{Color, Style},
20-
widgets::{Block, Borders, Paragraph, Text},
20+
widgets::{Block, Borders, Clear, Paragraph, Text},
2121
Frame,
2222
};
2323

@@ -40,17 +40,17 @@ impl DrawableComponent for CommitComponent {
4040
[Text::Raw(Cow::from(self.msg.clone()))]
4141
};
4242

43+
let area = ui::centered_rect(60, 20, f.size());
44+
f.render_widget(Clear, area);
4345
f.render_widget(
44-
ui::Clear::new(
45-
Paragraph::new(txt.iter())
46-
.block(
47-
Block::default()
48-
.title(strings::COMMIT_TITLE)
49-
.borders(Borders::ALL),
50-
)
51-
.alignment(Alignment::Left),
52-
),
53-
ui::centered_rect(60, 20, f.size()),
46+
Paragraph::new(txt.iter())
47+
.block(
48+
Block::default()
49+
.title(strings::COMMIT_TITLE)
50+
.borders(Borders::ALL),
51+
)
52+
.alignment(Alignment::Left),
53+
area,
5454
);
5555
}
5656
}

src/components/help.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use tui::{
1212
backend::Backend,
1313
layout::{Alignment, Constraint, Direction, Layout, Rect},
1414
style::{Color, Style},
15-
widgets::{Block, Borders, Paragraph, Text},
15+
widgets::{Block, Borders, Clear, Paragraph, Text},
1616
Frame,
1717
};
1818

@@ -41,12 +41,11 @@ impl DrawableComponent for HelpComponent {
4141
let area =
4242
ui::centered_rect_absolute(65, height, f.size());
4343

44+
f.render_widget(Clear, area);
4445
f.render_widget(
45-
ui::Clear::new(
46-
Block::default()
47-
.title(strings::HELP_TITLE)
48-
.borders(Borders::ALL),
49-
),
46+
Block::default()
47+
.title(strings::HELP_TITLE)
48+
.borders(Borders::ALL),
5049
area,
5150
);
5251

src/components/msg.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use strings::commands;
99
use tui::{
1010
backend::Backend,
1111
layout::{Alignment, Rect},
12-
widgets::{Block, Borders, Paragraph, Text},
12+
widgets::{Block, Borders, Clear, Paragraph, Text},
1313
Frame,
1414
};
1515

@@ -24,18 +24,18 @@ impl DrawableComponent for MsgComponent {
2424
if self.visible {
2525
let txt = vec![Text::Raw(Cow::from(self.msg.as_str()))];
2626

27+
let area = ui::centered_rect_absolute(65, 25, f.size());
28+
f.render_widget(Clear, area);
2729
f.render_widget(
28-
ui::Clear::new(
29-
Paragraph::new(txt.iter())
30-
.block(
31-
Block::default()
32-
.title(strings::MSG_TITLE)
33-
.borders(Borders::ALL),
34-
)
35-
.wrap(true)
36-
.alignment(Alignment::Left),
37-
),
38-
ui::centered_rect_absolute(65, 25, f.size()),
30+
Paragraph::new(txt.iter())
31+
.block(
32+
Block::default()
33+
.title(strings::MSG_TITLE)
34+
.borders(Borders::ALL),
35+
)
36+
.wrap(true)
37+
.alignment(Alignment::Left),
38+
area,
3939
);
4040
}
4141
}

src/components/reset.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use tui::{
1414
backend::Backend,
1515
layout::{Alignment, Rect},
1616
style::{Color, Style},
17-
widgets::{Block, Borders, Paragraph, Text},
17+
widgets::{Block, Borders, Clear, Paragraph, Text},
1818
Frame,
1919
};
2020

@@ -34,17 +34,17 @@ impl DrawableComponent for ResetComponent {
3434
Style::default().fg(Color::Red),
3535
));
3636

37+
let area = ui::centered_rect(30, 20, f.size());
38+
f.render_widget(Clear, area);
3739
f.render_widget(
38-
ui::Clear::new(
39-
Paragraph::new(txt.iter())
40-
.block(
41-
Block::default()
42-
.title(strings::RESET_TITLE)
43-
.borders(Borders::ALL),
44-
)
45-
.alignment(Alignment::Left),
46-
),
47-
ui::centered_rect(30, 20, f.size()),
40+
Paragraph::new(txt.iter())
41+
.block(
42+
Block::default()
43+
.title(strings::RESET_TITLE)
44+
.borders(Borders::ALL),
45+
)
46+
.alignment(Alignment::Left),
47+
area,
4848
);
4949
}
5050
}

src/ui/clear.rs

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/ui/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
mod clear;
21
mod scrolllist;
32

4-
pub use clear::Clear;
53
use scrolllist::ScrollableList;
64
use tui::{
75
backend::Backend,

0 commit comments

Comments
 (0)