bug: Fix missing states in processes (#345)

Fixes another change breaking states from showing in processes.
This commit is contained in:
Clement Tsang 2020-12-10 00:03:55 -05:00 committed by GitHub
parent 19cdc269fb
commit ce020a7429
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 64 additions and 44 deletions

View file

@ -15,6 +15,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Bug Fixes ## 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 ## [0.5.3] - 2020-11-26
## Bug Fixes ## Bug Fixes

View file

@ -239,7 +239,6 @@ Use `btm --help` for more information.
--mem_as_value Defaults to showing process memory usage by value. --mem_as_value Defaults to showing process memory usage by value.
-r, --rate <MS> Sets a refresh rate in ms. -r, --rate <MS> Sets a refresh rate in ms.
-R, --regex Enables regex by default. -R, --regex Enables regex by default.
--show_table_scroll_position Shows the scroll position tracker in table widgets
-d, --time_delta <MS> The amount in ms changed upon zooming. -d, --time_delta <MS> The amount in ms changed upon zooming.
-T, --tree Defaults to showing the process widget in tree mode. -T, --tree Defaults to showing the process widget in tree mode.
--use_old_network_legend DEPRECATED - uses the older network legend. --use_old_network_legend DEPRECATED - uses the older network legend.
@ -531,7 +530,7 @@ 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): These are the following supported flag config values, which correspond to the flag of the same name described in [Flags](#flags):
| Field | Type | | Field | Type |
| ---------------------------- | ------------------------------------------------------------------------------------- | | ------------------------ | ------------------------------------------------------------------------------------- |
| `hide_avg_cpu` | Boolean | | `hide_avg_cpu` | Boolean |
| `dot_marker` | Boolean | | `dot_marker` | Boolean |
| `left_legend` | Boolean | | `left_legend` | Boolean |
@ -555,7 +554,6 @@ These are the following supported flag config values, which correspond to the fl
| `color` | String (one of ["default", "default-light", "gruvbox", "gruvbox-light"]) | | `color` | String (one of ["default", "default-light", "gruvbox", "gruvbox-light"]) |
| `mem_as_value` | Boolean | | `mem_as_value` | Boolean |
| `tree` | Boolean | | `tree` | Boolean |
| `show_table_scroll_position` | Boolean |
#### Theming #### Theming

View file

@ -22,6 +22,19 @@ pub fn get_column_widths(
total_width: u16, hard_widths: &[Option<u16>], soft_widths_min: &[Option<u16>], total_width: u16, hard_widths: &[Option<u16>], soft_widths_min: &[Option<u16>],
soft_widths_max: &[Option<f64>], soft_widths_desired: &[Option<u16>], left_to_right: bool, soft_widths_max: &[Option<f64>], soft_widths_desired: &[Option<u16>], left_to_right: bool,
) -> Vec<u16> { ) -> Vec<u16> {
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 initial_width = total_width - 2;
let mut total_width_left = initial_width; let mut total_width_left = initial_width;
let mut column_widths: Vec<u16> = vec![0; hard_widths.len()]; let mut column_widths: Vec<u16> = vec![0; hard_widths.len()];

View file

@ -31,6 +31,7 @@ static PROCESS_HEADERS_HARD_WIDTH_NO_GROUP: Lazy<Vec<Option<u16>>> = Lazy::new(|
Some(8), Some(8),
Some(7), Some(7),
Some(8), Some(8),
None,
] ]
}); });
static PROCESS_HEADERS_HARD_WIDTH_GROUPED: Lazy<Vec<Option<u16>>> = Lazy::new(|| { static PROCESS_HEADERS_HARD_WIDTH_GROUPED: Lazy<Vec<Option<u16>>> = Lazy::new(|| {
@ -43,7 +44,6 @@ static PROCESS_HEADERS_HARD_WIDTH_GROUPED: Lazy<Vec<Option<u16>>> = Lazy::new(||
Some(8), Some(8),
Some(7), Some(7),
Some(8), Some(8),
None,
] ]
}); });

View file

@ -135,13 +135,13 @@ Hides the spacing between table headers and entries.\n\n",
"\ "\
Completely hides the time scaling from being shown.\n\n", Completely hides the time scaling from being shown.\n\n",
); );
let show_table_scroll_position = Arg::with_name("show_table_scroll_position") // let show_table_scroll_position = Arg::with_name("show_table_scroll_position")
.long("show_table_scroll_position") // .long("show_table_scroll_position")
.help("Shows the scroll position tracker in table widgets") // .help("Shows the scroll position tracker in table widgets")
.long_help( // .long_help(
"\ // "\
Shows the list scroll position tracker in the widget title for table widgets.\n\n", // Shows the list scroll position tracker in the widget title for table widgets.\n\n",
); // );
let left_legend = Arg::with_name("left_legend") let left_legend = Arg::with_name("left_legend")
.short("l") .short("l")
.long("left_legend") .long("left_legend")
@ -373,7 +373,7 @@ Defaults to showing the process widget in tree mode.\n\n",
.arg(hide_avg_cpu) .arg(hide_avg_cpu)
.arg(hide_table_gap) .arg(hide_table_gap)
.arg(hide_time) .arg(hide_time)
.arg(show_table_scroll_position) // .arg(show_table_scroll_position)
.arg(left_legend) .arg(left_legend)
// .arg(no_write) // .arg(no_write)
.arg(rate) .arg(rate)

View file

@ -977,13 +977,14 @@ fn get_is_default_tree(matches: &clap::ArgMatches<'static>, config: &Config) ->
false false
} }
fn get_show_table_scroll_position(matches: &clap::ArgMatches<'static>, config: &Config) -> bool { // FIXME: Re-enable this for 0.6
if matches.is_present("show_table_scroll_position") { fn get_show_table_scroll_position(_matches: &clap::ArgMatches<'static>, _config: &Config) -> bool {
return true; // if matches.is_present("show_table_scroll_position") {
} else if let Some(flags) = &config.flags { // return true;
if let Some(show_table_scroll_position) = flags.show_table_scroll_position { // } else if let Some(flags) = &config.flags {
return show_table_scroll_position; // if let Some(show_table_scroll_position) = flags.show_table_scroll_position {
} // return show_table_scroll_position;
} // }
// }
false false
} }