summaryrefslogtreecommitdiffstats
path: root/src/canvas
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2020-10-13 02:45:01 -0400
committerGitHub <noreply@github.com>2020-10-13 02:45:01 -0400
commit914079868f0bc5d1b709953bd8aaf0486ba32f65 (patch)
tree09cda26ee2aaf04a9ef7cabfa6314c1230c1b904 /src/canvas
parent5675d8192cbe94d7dbc3370315396a11a3aca02e (diff)
bug: Fix widget highlighting styling for dialogs (#266)
Fixes styling for dialog titles. Cherry picked from commit 06573becfa3c089ac4b2a17c9443f84b6a5af3e8.
Diffstat (limited to 'src/canvas')
-rw-r--r--src/canvas/dialogs/dd_dialog.rs41
-rw-r--r--src/canvas/dialogs/help_dialog.rs20
2 files changed, 36 insertions, 25 deletions
diff --git a/src/canvas/dialogs/dd_dialog.rs b/src/canvas/dialogs/dd_dialog.rs
index 50dbc7ef..5069f309 100644
--- a/src/canvas/dialogs/dd_dialog.rs
+++ b/src/canvas/dialogs/dd_dialog.rs
@@ -63,26 +63,33 @@ impl KillDialog for Painter {
) -> bool {
if let Some(dd_text) = dd_text {
let dd_title = if app_state.dd_err.is_some() {
- Span::styled(
- format!(
- " Error ─{}─ Esc to close ",
- "─".repeat(
- usize::from(draw_loc.width)
- .saturating_sub(DD_ERROR_BASE.chars().count() + 2)
- )
+ Spans::from(vec![
+ Span::styled(" Error ", self.colours.widget_title_style),
+ Span::styled(
+ format!(
+ "─{}─ Esc to close ",
+ "─".repeat(
+ usize::from(draw_loc.width)
+ .saturating_sub(DD_ERROR_BASE.chars().count() + 2)
+ )
+ ),
+ self.colours.border_style,
),
- self.colours.border_style,
- )
+ ])
} else {
- Span::styled(
- format!(
- " Confirm Kill Process ─{}─ Esc to close ",
- "─".repeat(
- usize::from(draw_loc.width).saturating_sub(DD_BASE.chars().count() + 2)
- )
+ Spans::from(vec![
+ Span::styled(" Confirm Kill Process ", self.colours.widget_title_style),
+ Span::styled(
+ format!(
+ "─{}─ Esc to close ",
+ "─".repeat(
+ usize::from(draw_loc.width)
+ .saturating_sub(DD_BASE.chars().count() + 2)
+ )
+ ),
+ self.colours.border_style,
),
- self.colours.border_style,
- )
+ ])
};
f.render_widget(
diff --git a/src/canvas/dialogs/help_dialog.rs b/src/canvas/dialogs/help_dialog.rs
index 752dc858..b3c9f579 100644
--- a/src/canvas/dialogs/help_dialog.rs
+++ b/src/canvas/dialogs/help_dialog.rs
@@ -6,6 +6,7 @@ use tui::{
layout::{Alignment, Rect},
terminal::Frame,
text::Span,
+ text::Spans,
widgets::{Block, Borders, Paragraph, Wrap},
};
@@ -22,15 +23,18 @@ impl HelpDialog for Painter {
fn draw_help_dialog<B: Backend>(
&self, f: &mut Frame<'_, B>, app_state: &mut App, draw_loc: Rect,
) {
- let help_title = Span::styled(
- format!(
- " Help ─{}─ Esc to close ",
- "─".repeat(
- usize::from(draw_loc.width).saturating_sub(HELP_BASE.chars().count() + 2)
- )
+ let help_title = Spans::from(vec![
+ Span::styled(" Help ", self.colours.widget_title_style),
+ Span::styled(
+ format!(
+ "─{}─ Esc to close ",
+ "─".repeat(
+ usize::from(draw_loc.width).saturating_sub(HELP_BASE.chars().count() + 2)
+ )
+ ),
+ self.colours.border_style,
),
- self.colours.border_style,
- );
+ ]);
if app_state.should_get_widget_bounds() {
// We must also recalculate how many lines are wrapping to properly get scrolling to work on