diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2020-08-16 01:25:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-16 04:25:59 -0400 |
commit | 08e49b63c162f16cb35262cd48da324c779c1a1c (patch) | |
tree | 446d654cb60cbd0475b193b6e28900bad46c88e8 /src/canvas/widgets/mem_basic.rs | |
parent | 9068108d0fe977ec6fc01dc7d8d29674a88c2f6a (diff) |
refactor: Revert tui upgrade to 0.10
Reverts tui upgrade, there are some bugs and issues - namely, issues with rendering text.
We can revert this commit when those bugs are dealt with (should be fine after 0.10.1, tested building from the repo).
Diffstat (limited to 'src/canvas/widgets/mem_basic.rs')
-rw-r--r-- | src/canvas/widgets/mem_basic.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/canvas/widgets/mem_basic.rs b/src/canvas/widgets/mem_basic.rs index 43003e86..c4498316 100644 --- a/src/canvas/widgets/mem_basic.rs +++ b/src/canvas/widgets/mem_basic.rs @@ -8,8 +8,7 @@ use tui::{ backend::Backend, layout::{Constraint, Layout, Rect}, terminal::Frame, - text::{Span, Spans}, - widgets::{Block, Paragraph}, + widgets::{Block, Paragraph, Text}, }; pub trait MemBasicWidget { @@ -54,7 +53,7 @@ impl MemBasicWidget for Painter { let num_bars_ram = calculate_basic_use_bars(ram_use_percentage, bar_length); let num_bars_swap = calculate_basic_use_bars(swap_use_percentage, bar_length); let mem_label = format!( - "RAM[{}{}{:3.0}%]", + "RAM[{}{}{:3.0}%]\n", "|".repeat(num_bars_ram), " ".repeat(bar_length - num_bars_ram), ram_use_percentage.round(), @@ -66,13 +65,13 @@ impl MemBasicWidget for Painter { swap_use_percentage.round(), ); - let mem_text = vec![ - Spans::from(Span::styled(mem_label, self.colours.ram_style)), - Spans::from(Span::styled(swap_label, self.colours.swap_style)), + let mem_text = [ + Text::styled(mem_label, self.colours.ram_style), + Text::styled(swap_label, self.colours.swap_style), ]; f.render_widget( - Paragraph::new(mem_text).block(Block::default()), + Paragraph::new(mem_text.iter()).block(Block::default()), margined_loc[0], ); } |