summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2020-04-07 21:42:57 -0400
committerGitHub <noreply@github.com>2020-04-07 21:42:57 -0400
commitb32c9848433ce068776ed4bc3d86f9634457db8c (patch)
tree63ac0fac4a89aab7d9694a2e63e473da3aa8544a
parent46e0eee1d32bdf38376d197abf0dda4e70dec8fc (diff)
bug: Fix sorting processes by name being case-sensitive
-rw-r--r--CHANGELOG.md2
-rw-r--r--src/main.rs8
2 files changed, 7 insertions, 3 deletions
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<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,
)
})