Refactor todo view sorting to explicit mode enum#928
Merged
multiplex55 merged 1 commit intomasterfrom Mar 13, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
sort_by_prioritywith an explicit mode to make sorting behavior clearer and extendable.PriorityorNamewhile keeping the existing filter behavior.Description
enum TodoSortMode { Priority, Name }and replaceTodoViewDialog.sort_by_priority: boolwithsort_mode: TodoSortMode, defaulting toPriorityinopen()andopen_edit().fn sorted_todo_indices(entries, filter, sort_mode) -> Vec<usize>that centralizes filtering and index-based sorting and preserves index indirection for edits/removals.Prioritymode sort bypriority(desc) thentext.to_lowercase()(asc) then original index; inNamemode sort bytext.to_lowercase()(asc) thenpriority(desc) then original index.egui::ComboBoxofferingPriorityandName, and add unit tests in the existing#[cfg(test)] mod teststhat exercise priority ordering, name ordering, stability/tie-breaks, and filter+sort interaction.Testing
cargo fmt --allwhich completed successfully.cargo test src::gui::todo_view_dialog -- --nocapturebut the build/test run failed in this environment due to a system dependency error fromalsa-sys(pkg-config/ missingalsa.pc), so the new unit tests could not be executed here.Codex Task