diff --git a/CHANGELOG.md b/CHANGELOG.md index 6917f909..0974dc00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/src/main.rs b/src/main.rs index a53408d6..7b4d4660 100644 --- a/src/main.rs +++ b/src/main.rs @@ -670,7 +670,9 @@ fn update_final_process_list(app: &mut App, widget_id: u64) { fn sort_process_data( to_sort_vec: &mut Vec, 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, ) })