bug: fix not switching sort type when toggling % in mem
This commit is contained in:
parent
3c373d7129
commit
eb5ac54ad0
20
src/app.rs
20
src/app.rs
|
@ -359,9 +359,25 @@ impl App {
|
|||
proc_widget_state
|
||||
.columns
|
||||
.toggle(&processes::ProcessSorting::Mem);
|
||||
proc_widget_state
|
||||
if let Some(mem_percent_state) = proc_widget_state
|
||||
.columns
|
||||
.toggle(&processes::ProcessSorting::MemPercent);
|
||||
.toggle(&processes::ProcessSorting::MemPercent)
|
||||
{
|
||||
if proc_widget_state.process_sorting_type
|
||||
== processes::ProcessSorting::MemPercent
|
||||
|| proc_widget_state.process_sorting_type
|
||||
== processes::ProcessSorting::Mem
|
||||
{
|
||||
if mem_percent_state {
|
||||
proc_widget_state.process_sorting_type =
|
||||
processes::ProcessSorting::MemPercent;
|
||||
} else {
|
||||
proc_widget_state.process_sorting_type =
|
||||
processes::ProcessSorting::Mem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.proc_state.force_update = Some(self.current_widget.widget_id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -260,9 +260,13 @@ impl Default for ProcColumn {
|
|||
}
|
||||
|
||||
impl ProcColumn {
|
||||
pub fn toggle(&mut self, column: &ProcessSorting) {
|
||||
/// Returns its new status.
|
||||
pub fn toggle(&mut self, column: &ProcessSorting) -> Option<bool> {
|
||||
if let Some(mapping) = self.column_mapping.get_mut(column) {
|
||||
mapping.enabled = !(mapping.enabled);
|
||||
Some(mapping.enabled)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue