bug: Fix sorting processes by name being case-sensitive

This commit is contained in:
Clement Tsang 2020-04-07 21:42:57 -04:00 committed by GitHub
parent 46e0eee1d3
commit b32c984843
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -31,6 +31,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#40](https://github.com/ClementTsang/bottom/issues/40): Rewrote README to be more clear and explicit.
- [#109](https://github.com/ClementTsang/bottom/issues/109): Sorting processes by name is case-insensitive.
### Bug Fixes
- [#33](https://github.com/ClementTsang/bottom/issues/33): Fix bug with search and graphemes bigger than a byte crashing due to the cursor.

View File

@ -670,7 +670,9 @@ fn update_final_process_list(app: &mut App, widget_id: u64) {
fn sort_process_data(
to_sort_vec: &mut Vec<ConvertedProcessData>, proc_widget_state: &app::ProcWidgetState,
) {
to_sort_vec.sort_by(|a, b| utils::gen_util::get_ordering(&a.name, &b.name, false));
to_sort_vec.sort_by(|a, b| {
utils::gen_util::get_ordering(&a.name.to_lowercase(), &b.name.to_lowercase(), false)
});
match proc_widget_state.process_sorting_type {
ProcessSorting::CPU => {
@ -696,8 +698,8 @@ fn sort_process_data(
if proc_widget_state.process_sorting_reverse {
to_sort_vec.sort_by(|a, b| {
utils::gen_util::get_ordering(
&a.name,
&b.name,
&a.name.to_lowercase(),
&b.name.to_lowercase(),
proc_widget_state.process_sorting_reverse,
)
})