summaryrefslogtreecommitdiffstats
path: root/src/canvas.rs
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2020-09-26 20:04:34 -0400
committerClementTsang <cjhtsang@uwaterloo.ca>2020-09-26 20:21:59 -0400
commit750d8f3cb747103cca7a2a4afe8ff41ff1318b6f (patch)
treeac34a6a538c1f94cb395b20a23c9186b749ca6e6 /src/canvas.rs
parent6db76029e2419d53c81cb2111e487f83ee248a2f (diff)
refactor: tui-rs 0.11.0 refactor (#253)
Refactors tui-rs usage to the new 0.11.0 release. This release also fixes the highlighting bug from #249, and now, expanding a widget no longer overrides the widget title colour. This commit also introduces #255, but that seems to be easy to bandaid so hopefully it will get fixed soon?
Diffstat (limited to 'src/canvas.rs')
-rw-r--r--src/canvas.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/canvas.rs b/src/canvas.rs
index f4707507..bc142194 100644
--- a/src/canvas.rs
+++ b/src/canvas.rs
@@ -5,7 +5,7 @@ use std::collections::HashMap;
use tui::{
backend::Backend,
layout::{Constraint, Direction, Layout, Rect},
- widgets::Text,
+ text::{Span, Spans},
Frame, Terminal,
};
@@ -63,7 +63,7 @@ pub struct Painter {
pub colours: CanvasColours,
height: u16,
width: u16,
- styled_help_text: Vec<Text<'static>>,
+ styled_help_text: Vec<Spans<'static>>,
is_mac_os: bool,
row_constraints: Vec<Constraint>,
col_constraints: Vec<Vec<Constraint>>,
@@ -289,28 +289,27 @@ impl Painter {
styled_help_spans.extend(
section
.iter()
- .map(|&text| Text::styled(text, self.colours.text_style))
+ .map(|&text| Span::styled(text, self.colours.text_style))
.collect::<Vec<_>>(),
);
} else {
// Not required check but it runs only a few times... so whatever ig, prevents me from
// being dumb and leaving a help text section only one line long.
if section.len() > 1 {
- styled_help_spans.push(Text::raw("\n\n"));
+ styled_help_spans.push(Span::raw(""));
styled_help_spans
- .push(Text::styled(section[0], self.colours.table_header_style));
+ .push(Span::styled(section[0], self.colours.table_header_style));
styled_help_spans.extend(
section[1..]
.iter()
- .map(|&text| Text::styled(text, self.colours.text_style))
+ .map(|&text| Span::styled(text, self.colours.text_style))
.collect::<Vec<_>>(),
);
}
}
});
- // self.styled_help_text = styled_help_spans.into_iter().map(Spans::from).collect();
- self.styled_help_text = styled_help_spans;
+ self.styled_help_text = styled_help_spans.into_iter().map(Spans::from).collect();
}
// FIXME: [CONFIG] write this, should call painter init and any changed colour functions...