bug: Fix missing sorting arrow when for non-% mem (#389)

Fixes a bug where you could make the sorting arrow disappear in the mem column if you did:

1. Go to proc widget
2. Switch to memory values from %
3. Press `m`
This commit is contained in:
Clement Tsang 2021-01-12 21:41:59 -05:00 committed by GitHub
parent c57ce0b45a
commit e30518bf62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 7 deletions

View file

@ -25,6 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#386](https://github.com/ClementTsang/bottom/pull/386): Fixes `hide_table_gap` not working in the battery widget.
- [#389](https://github.com/ClementTsang/bottom/pull/389): Fixes the sorting arrow disappearing in proc widget under some cases.
## [0.5.6] - 2020-12-17
## Bug Fixes

4
Cargo.lock generated
View file

@ -1122,9 +1122,9 @@ dependencies = [
[[package]]
name = "predicates"
version = "1.0.5"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96bfead12e90dccead362d62bb2c90a5f6fc4584963645bc7f71a735e0b0735a"
checksum = "73dd9b7b200044694dfede9edf907c1ca19630908443e9447e624993700c6932"
dependencies = [
"difference",
"float-cmp",

View file

@ -72,8 +72,8 @@ heim = { version = "0.1.0-rc.1", features = ["disk", "memory"] }
winapi = "0.3.9"
[dev-dependencies]
assert_cmd = "~1.0"
predicates = "1"
assert_cmd = "1.0.2"
predicates = "1.0.6"
[build-dependencies]
clap = "2.33"

View file

@ -1423,13 +1423,21 @@ impl App {
.get_mut_widget_state(self.current_widget.widget_id)
{
match proc_widget_state.process_sorting_type {
processes::ProcessSorting::MemPercent => {
processes::ProcessSorting::MemPercent
| processes::ProcessSorting::Mem => {
proc_widget_state.is_process_sort_descending =
!proc_widget_state.is_process_sort_descending
}
_ => {
proc_widget_state.process_sorting_type =
processes::ProcessSorting::MemPercent;
proc_widget_state.process_sorting_type = if proc_widget_state
.columns
.is_enabled(&processes::ProcessSorting::MemPercent)
{
processes::ProcessSorting::MemPercent
} else {
processes::ProcessSorting::Mem
};
proc_widget_state.is_process_sort_descending = true;
}
}