diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2020-08-15 17:35:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-15 20:35:49 -0400 |
commit | f3897f0538f90c682b96bc340c3c05e80be10b2d (patch) | |
tree | f24673d4d5702e48b9d3d1889f7498c97ac238a1 /src/canvas.rs | |
parent | 84f63f2f8306382dbf5cab819589161bf0b7c093 (diff) |
feature: Allow sorting by any column
This feature allows any column to be sortable.
This also adds:
- Inverting sort for current column with `I`
- Invoking a sort widget with `s` or `F6`. Close with same key or esc.
And:
- A bugfix in regards the basic menu and battery widget
- A lot of refactoring
Diffstat (limited to 'src/canvas.rs')
-rw-r--r-- | src/canvas.rs | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/src/canvas.rs b/src/canvas.rs index 4e846bf6..8ff9c31b 100644 --- a/src/canvas.rs +++ b/src/canvas.rs @@ -356,20 +356,16 @@ impl Painter { app_state.current_widget.widget_id, false, ), - Proc => self.draw_process_and_search( - &mut f, - app_state, - rect[0], - true, - app_state.current_widget.widget_id, - ), - ProcSearch => self.draw_process_and_search( - &mut f, - app_state, - rect[0], - true, - app_state.current_widget.widget_id - 1, - ), + proc_type @ Proc | proc_type @ ProcSearch | proc_type @ ProcSort => { + let widget_id = app_state.current_widget.widget_id + - match proc_type { + ProcSearch => 1, + ProcSort => 2, + _ => 0, + }; + + self.draw_process_features(&mut f, app_state, rect[0], true, widget_id); + } Battery => self.draw_battery_display( &mut f, app_state, @@ -430,13 +426,20 @@ impl Painter { false, widget_id, ), - Proc => self.draw_process_and_search( - &mut f, - app_state, - vertical_chunks[4], - false, - widget_id, - ), + Proc | ProcSort => { + let wid = widget_id + - match basic_table_widget_state.currently_displayed_widget_type { + ProcSort => 2, + _ => 0, + }; + self.draw_process_features( + &mut f, + app_state, + vertical_chunks[4], + false, + wid, + ); + } Temp => self.draw_temp_table( &mut f, app_state, @@ -575,7 +578,7 @@ impl Painter { Disk => { self.draw_disk_table(f, app_state, *widget_draw_loc, true, widget.widget_id) } - Proc => self.draw_process_and_search( + Proc => self.draw_process_features( f, app_state, *widget_draw_loc, |