Skip to content

Commit 4cd9c41

Browse files
committed
Use Span::styled in .title rather than .title_style in Paragraph
1 parent e168bdc commit 4cd9c41

File tree

7 files changed

+22
-17
lines changed

7 files changed

+22
-17
lines changed

src/components/commitlist.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,11 @@ impl DrawableComponent for CommitList {
318318
.block(
319319
Block::default()
320320
.borders(Borders::ALL)
321-
.title(title.as_str())
322-
.border_style(self.theme.block(true))
323-
.title_style(self.theme.title(true)),
321+
.title(Span::styled(
322+
title.as_str(),
323+
self.theme.title(true),
324+
))
325+
.border_style(self.theme.block(true)),
324326
)
325327
.alignment(Alignment::Left),
326328
area,

src/components/diff.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,12 @@ impl DrawableComponent for DiffComponent {
576576
f.render_widget(
577577
Paragraph::new(txt).block(
578578
Block::default()
579-
.title(title.as_str())
579+
.title(Span::styled(
580+
title.as_str(),
581+
self.theme.title(self.focused),
582+
))
580583
.borders(Borders::ALL)
581-
.border_style(self.theme.block(self.focused))
582-
.title_style(self.theme.title(self.focused)),
584+
.border_style(self.theme.block(self.focused)),
583585
),
584586
r,
585587
);

src/components/externaleditor.rs

-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ impl DrawableComponent for ExternalEditorComponent {
117117
Block::default()
118118
.borders(Borders::ALL)
119119
.border_type(BorderType::Thick)
120-
.title_style(self.theme.title(true))
121120
.border_style(self.theme.block(true)),
122121
)
123122
.style(self.theme.text_danger()),

src/components/mod.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,8 @@ fn dialog_paragraph<'a>(
193193
Paragraph::new(Spans::from(content))
194194
.block(
195195
Block::default()
196-
.title(title)
196+
.title(Span::styled(title, theme.title(focused)))
197197
.borders(Borders::ALL)
198-
.title_style(theme.title(focused))
199198
.border_style(theme.block(focused)),
200199
)
201200
.alignment(Alignment::Left)
@@ -210,10 +209,9 @@ fn popup_paragraph<'a>(
210209
Paragraph::new(Spans::from(content))
211210
.block(
212211
Block::default()
213-
.title(title)
212+
.title(Span::styled(title, theme.title(focused)))
214213
.borders(Borders::ALL)
215214
.border_type(BorderType::Thick)
216-
.title_style(theme.title(focused))
217215
.border_style(theme.block(focused)),
218216
)
219217
.alignment(Alignment::Left)

src/components/msg.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ impl DrawableComponent for MsgComponent {
4545
Paragraph::new(txt)
4646
.block(
4747
Block::default()
48-
.title(self.title.as_str())
49-
.title_style(self.theme.text_danger())
48+
.title(Span::styled(
49+
self.title.as_str(),
50+
self.theme.text_danger(),
51+
))
5052
.borders(Borders::ALL)
5153
.border_type(BorderType::Thick),
5254
)

src/components/push.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use tui::{
1919
backend::Backend,
2020
layout::Rect,
2121
style::{Color, Style},
22+
text::Span,
2223
widgets::{Block, BorderType, Borders, Clear, Gauge},
2324
Frame,
2425
};
@@ -146,10 +147,12 @@ impl DrawableComponent for PushComponent {
146147
.label(state.as_str())
147148
.block(
148149
Block::default()
149-
.title(strings::PUSH_POPUP_MSG)
150+
.title(Span::styled(
151+
strings::PUSH_POPUP_MSG,
152+
self.theme.title(true),
153+
))
150154
.borders(Borders::ALL)
151155
.border_type(BorderType::Thick)
152-
.title_style(self.theme.title(true))
153156
.border_style(self.theme.block(true)),
154157
)
155158
.style(

src/ui/scrolllist.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,8 @@ pub fn draw_list<'b, B: Backend, L>(
7777
let list = ScrollableList::new(items)
7878
.block(
7979
Block::default()
80-
.title(title)
80+
.title(Span::styled(title, theme.title(selected)))
8181
.borders(Borders::ALL)
82-
.title_style(theme.title(selected))
8382
.border_style(theme.block(selected)),
8483
)
8584
.scroll(select.unwrap_or_default());

0 commit comments

Comments
 (0)