diff --git a/Cargo.lock b/Cargo.lock index 10511395..e61098e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -595,7 +595,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.60.2", + "windows-sys 0.61.0", ] [[package]] @@ -662,7 +662,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.60.2", + "windows-sys 0.61.0", ] [[package]] @@ -1669,7 +1669,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.60.2", + "windows-sys 0.61.0", ] [[package]] @@ -1977,7 +1977,7 @@ dependencies = [ "fastrand", "once_cell", "rustix", - "windows-sys 0.60.2", + "windows-sys 0.61.0", ] [[package]] @@ -2467,7 +2467,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 87518ef8..387e92b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,9 +38,9 @@ exclude = [ "profile.json.gz", "rustfmt.toml", ] -edition = "2024" +edition = "2021" # The oldest version I've tested that should still build - note this is not an official MSRV! -rust-version = "1.85" +rust-version = "1.81" [lib] test = true diff --git a/src/canvas/components/time_graph/base.rs b/src/canvas/components/time_graph/base.rs index 1d349881..4e372f6c 100644 --- a/src/canvas/components/time_graph/base.rs +++ b/src/canvas/components/time_graph/base.rs @@ -196,11 +196,13 @@ fn create_dataset(data: GraphData<'_>) -> Dataset<'_> { .data(time, values) .graph_type(GraphType::Line); - if let Some(name) = name { + let dataset = if let Some(name) = name { dataset.name(name) } else { dataset - } + }; + + dataset } #[cfg(test)] diff --git a/src/canvas/components/time_graph/base/time_chart/canvas.rs b/src/canvas/components/time_graph/base/time_chart/canvas.rs index cdabe82b..34e40e9f 100644 --- a/src/canvas/components/time_graph/base/time_chart/canvas.rs +++ b/src/canvas/components/time_graph/base/time_chart/canvas.rs @@ -188,12 +188,16 @@ impl<'a> Context<'a> { pub fn new( width: u16, height: u16, x_bounds: [f64; 2], y_bounds: [f64; 2], marker: symbols::Marker, ) -> Context<'a> { + // FIXME: Temporarily added due to ratatui things + #[allow(unreachable_patterns)] let grid: Box = match marker { symbols::Marker::Dot => Box::new(CharGrid::new(width, height, '•')), symbols::Marker::Block => Box::new(CharGrid::new(width, height, '█')), symbols::Marker::Bar => Box::new(CharGrid::new(width, height, '▄')), symbols::Marker::Braille => Box::new(BrailleGrid::new(width, height)), symbols::Marker::HalfBlock => Box::new(HalfBlockGrid::new(width, height)), + // FIXME: Fall back to braille for now. + _ => Box::new(BrailleGrid::new(width, height)), }; Context { x_bounds, diff --git a/src/canvas/components/time_graph/base/time_chart/grid.rs b/src/canvas/components/time_graph/base/time_chart/grid.rs index fd7882b5..2863af98 100644 --- a/src/canvas/components/time_graph/base/time_chart/grid.rs +++ b/src/canvas/components/time_graph/base/time_chart/grid.rs @@ -3,6 +3,15 @@ use std::{fmt::Debug, iter::zip}; use itertools::Itertools; use tui::{style::Color, symbols}; +// FIXME: These are temporary while people are having issues with ratatui. +const BLANK: u16 = 0x2800; +const DOTS: [[u16; 2]; 4] = [ + [0x0001, 0x0008], + [0x0002, 0x0010], + [0x0004, 0x0020], + [0x0040, 0x0080], +]; + #[derive(Debug, Clone)] pub(super) struct Layer { pub(super) string: String, @@ -63,7 +72,7 @@ impl BrailleGrid { Self { width, height, - utf16_code_points: vec![symbols::braille::BLANK; length], + utf16_code_points: vec![BLANK; length], colors: vec![Color::Reset; length], } } @@ -82,7 +91,7 @@ impl Grid for BrailleGrid { } fn reset(&mut self) { - self.utf16_code_points.fill(symbols::braille::BLANK); + self.utf16_code_points.fill(BLANK); self.colors.fill(Color::Reset); } @@ -99,7 +108,7 @@ impl Grid for BrailleGrid { // look but it also makes it a bit harder to read in some cases. // if let Some(c) = self.utf16_code_points.get_mut(index) { - // *c |= symbols::braille::DOTS[y % 4][x % 2]; + // *c |= DOTS[y % 4][x % 2]; // } // if let Some(c) = self.colors.get_mut(index) { // *c = color; @@ -110,10 +119,10 @@ impl Grid for BrailleGrid { if *curr_color != color { *curr_color = color; if let Some(cell) = self.utf16_code_points.get_mut(index) { - *cell = symbols::braille::BLANK | symbols::braille::DOTS[y % 4][x % 2]; + *cell = BLANK | DOTS[y % 4][x % 2]; } } else if let Some(cell) = self.utf16_code_points.get_mut(index) { - *cell |= symbols::braille::DOTS[y % 4][x % 2]; + *cell |= DOTS[y % 4][x % 2]; } } } diff --git a/src/canvas/widgets/network_graph.rs b/src/canvas/widgets/network_graph.rs index 87472c05..7e6e3d46 100644 --- a/src/canvas/widgets/network_graph.rs +++ b/src/canvas/widgets/network_graph.rs @@ -288,7 +288,8 @@ impl Painter { f.render_widget( Table::new( total_network, - &((std::iter::repeat_n(draw_loc.width.saturating_sub(2) / 4, 4)) + &((std::iter::repeat(draw_loc.width.saturating_sub(2) / 4)) + .take(4) .map(Constraint::Length) .collect::>()), ) diff --git a/src/options.rs b/src/options.rs index f899caca..5bd333be 100644 --- a/src/options.rs +++ b/src/options.rs @@ -756,11 +756,13 @@ fn get_default_cpu_selection(args: &BottomArgs, config: &Config) -> config::cpu: } fn get_dedicated_avg_row(config: &Config) -> bool { - config + let conf = config .flags .as_ref() .and_then(|flags| flags.average_cpu_row) - .unwrap_or(false) + .unwrap_or(false); + + conf } #[inline]