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
## [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

View file

@ -239,7 +239,6 @@ Use `btm --help` for more information.
--mem_as_value Defaults to showing process memory usage by value.
-r, --rate <MS> 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 <MS> 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

View file

@ -22,6 +22,19 @@ pub fn get_column_widths(
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,
) -> 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 mut total_width_left = initial_width;
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(7),
Some(8),
None,
]
});
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(7),
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",
);
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)

View file

@ -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
}