From ce020a7429d410e5eaaa1bfe3cb42f87f4f65092 Mon Sep 17 00:00:00 2001 From: Clement Tsang <34804052+ClementTsang@users.noreply.github.com> Date: Thu, 10 Dec 2020 00:03:55 -0500 Subject: bug: Fix missing states in processes (#345) Fixes another change breaking states from showing in processes. --- CHANGELOG.md | 8 ++++++ README.md | 52 ++++++++++++++++++------------------- src/canvas/drawing_utils.rs | 13 ++++++++++ src/canvas/widgets/process_table.rs | 2 +- src/clap.rs | 16 ++++++------ src/options.rs | 17 ++++++------ 6 files changed, 64 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5b0cebb..1c5ce586 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Bug Fixes +## [0.5.4] - Unreleased + +## Changes + +## Bug Fixes + +- [#345](https://github.com/ClementTsang/bottom/pull/345): Fixes process states not showing. + ## [0.5.3] - 2020-11-26 ## Bug Fixes diff --git a/README.md b/README.md index dc5902e9..32658739 100644 --- a/README.md +++ b/README.md @@ -239,7 +239,6 @@ Use `btm --help` for more information. --mem_as_value Defaults to showing process memory usage by value. -r, --rate Sets a refresh rate in ms. -R, --regex Enables regex by default. - --show_table_scroll_position Shows the scroll position tracker in table widgets -d, --time_delta The amount in ms changed upon zooming. -T, --tree Defaults to showing the process widget in tree mode. --use_old_network_legend DEPRECATED - uses the older network legend. @@ -530,32 +529,31 @@ The following options can be set under `[flags]` to achieve the same effect as p These are the following supported flag config values, which correspond to the flag of the same name described in [Flags](#flags): -| Field | Type | -| ---------------------------- | ------------------------------------------------------------------------------------- | -| `hide_avg_cpu` | Boolean | -| `dot_marker` | Boolean | -| `left_legend` | Boolean | -| `current_usage` | Boolean | -| `group_processes` | Boolean | -| `case_sensitive` | Boolean | -| `whole_word` | Boolean | -| `regex` | Boolean | -| `show_disabled_data` | Boolean | -| `basic` | Boolean | -| `hide_table_count` | Boolean | -| `use_old_network_legend` | Boolean | -| `battery` | Boolean | -| `rate` | Unsigned Int (represents milliseconds) | -| `default_time_value` | Unsigned Int (represents milliseconds) | -| `time_delta` | Unsigned Int (represents milliseconds) | -| `temperature_type` | String (one of ["k", "f", "c", "kelvin", "fahrenheit", "celsius"]) | -| `default_widget_type` | String (one of ["cpu", "proc", "net", "temp", "mem", "disk"], same as layout options) | -| `default_widget_count` | Unsigned Int (represents which `default_widget_type`) | -| `disable_click` | Boolean | -| `color` | String (one of ["default", "default-light", "gruvbox", "gruvbox-light"]) | -| `mem_as_value` | Boolean | -| `tree` | Boolean | -| `show_table_scroll_position` | Boolean | +| Field | Type | +| ------------------------ | ------------------------------------------------------------------------------------- | +| `hide_avg_cpu` | Boolean | +| `dot_marker` | Boolean | +| `left_legend` | Boolean | +| `current_usage` | Boolean | +| `group_processes` | Boolean | +| `case_sensitive` | Boolean | +| `whole_word` | Boolean | +| `regex` | Boolean | +| `show_disabled_data` | Boolean | +| `basic` | Boolean | +| `hide_table_count` | Boolean | +| `use_old_network_legend` | Boolean | +| `battery` | Boolean | +| `rate` | Unsigned Int (represents milliseconds) | +| `default_time_value` | Unsigned Int (represents milliseconds) | +| `time_delta` | Unsigned Int (represents milliseconds) | +| `temperature_type` | String (one of ["k", "f", "c", "kelvin", "fahrenheit", "celsius"]) | +| `default_widget_type` | String (one of ["cpu", "proc", "net", "temp", "mem", "disk"], same as layout options) | +| `default_widget_count` | Unsigned Int (represents which `default_widget_type`) | +| `disable_click` | Boolean | +| `color` | String (one of ["default", "default-light", "gruvbox", "gruvbox-light"]) | +| `mem_as_value` | Boolean | +| `tree` | Boolean | #### Theming diff --git a/src/canvas/drawing_utils.rs b/src/canvas/drawing_utils.rs index 99bf799f..222ca852 100644 --- a/src/canvas/drawing_utils.rs +++ b/src/canvas/drawing_utils.rs @@ -22,6 +22,19 @@ pub fn get_column_widths( total_width: u16, hard_widths: &[Option], soft_widths_min: &[Option], soft_widths_max: &[Option], soft_widths_desired: &[Option], left_to_right: bool, ) -> Vec { + debug_assert!( + hard_widths.len() == soft_widths_min.len(), + "hard width length != soft width min length!" + ); + debug_assert!( + soft_widths_min.len() == soft_widths_max.len(), + "soft width min length != soft width max length!" + ); + debug_assert!( + soft_widths_max.len() == soft_widths_desired.len(), + "soft width max length != soft width desired length!" + ); + let initial_width = total_width - 2; let mut total_width_left = initial_width; let mut column_widths: Vec = vec![0; hard_widths.len()]; diff --git a/src/canvas/widgets/process_table.rs b/src/canvas/widgets/process_table.rs index 338118b4..b49dfea4 100644 --- a/src/canvas/widgets/process_table.rs +++ b/src/canvas/widgets/process_table.rs @@ -31,6 +31,7 @@ static PROCESS_HEADERS_HARD_WIDTH_NO_GROUP: Lazy>> = Lazy::new(| Some(8), Some(7), Some(8), + None, ] }); static PROCESS_HEADERS_HARD_WIDTH_GROUPED: Lazy>> = Lazy::new(|| { @@ -43,7 +44,6 @@ static PROCESS_HEADERS_HARD_WIDTH_GROUPED: Lazy>> = Lazy::new(|| Some(8), Some(7), Some(8), - None, ] }); diff --git a/src/clap.rs b/src/clap.rs index 50939f5a..3a50ee54 100644 --- a/src/clap.rs +++ b/src/clap.rs @@ -135,13 +135,13 @@ Hides the spacing between table headers and entries.\n\n", "\ Completely hides the time scaling from being shown.\n\n", ); - let show_table_scroll_position = Arg::with_name("show_table_scroll_position") - .long("show_table_scroll_position") - .help("Shows the scroll position tracker in table widgets") - .long_help( - "\ - Shows the list scroll position tracker in the widget title for table widgets.\n\n", - ); + // let show_table_scroll_position = Arg::with_name("show_table_scroll_position") + // .long("show_table_scroll_position") + // .help("Shows the scroll position tracker in table widgets") + // .long_help( + // "\ + // Shows the list scroll position tracker in the widget title for table widgets.\n\n", + // ); let left_legend = Arg::with_name("left_legend") .short("l") .long("left_legend") @@ -373,7 +373,7 @@ Defaults to showing the process widget in tree mode.\n\n", .arg(hide_avg_cpu) .arg(hide_table_gap) .arg(hide_time) - .arg(show_table_scroll_position) + // .arg(show_table_scroll_position) .arg(left_legend) // .arg(no_write) .arg(rate) diff --git a/src/options.rs b/src/options.rs index cfdeca88..f3f6305c 100644 --- a/src/options.rs +++ b/src/options.rs @@ -977,13 +977,14 @@ fn get_is_default_tree(matches: &clap::ArgMatches<'static>, config: &Config) -> false } -fn get_show_table_scroll_position(matches: &clap::ArgMatches<'static>, config: &Config) -> bool { - if matches.is_present("show_table_scroll_position") { - return true; - } else if let Some(flags) = &config.flags { - if let Some(show_table_scroll_position) = flags.show_table_scroll_position { - return show_table_scroll_position; - } - } +// FIXME: Re-enable this for 0.6 +fn get_show_table_scroll_position(_matches: &clap::ArgMatches<'static>, _config: &Config) -> bool { + // if matches.is_present("show_table_scroll_position") { + // return true; + // } else if let Some(flags) = &config.flags { + // if let Some(show_table_scroll_position) = flags.show_table_scroll_position { + // return show_table_scroll_position; + // } + // } false } -- cgit v1.2.3