feat(tui): cycle profiles in config-file order#14
Merged
Conversation
Profiles loaded into a BTreeMap sorted alphabetically, so the TUI switcher (P/Ctrl+P) walked alpha order, not the order in config.toml. Switch Config.profiles to an order-preserving IndexMap and enable toml's preserve_order so document order survives deserialization; the switcher, profile list, and config show now all follow file order. Lock it with a deserialization-order test.
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.
Summary
The TUI profile switcher (
P/Ctrl+P) cycled profiles alphabetically becauseConfig.profileswas aBTreeMap. This switches it to an order-preservingIndexMapand enablestoml'spreserve_orderfeature so[profiles.*]keep their TOML document order through deserialization.Now the switcher,
profile list, andconfig showall follow config-file order. No config change needed;indexmapwas already in the lockfile transitively.This is goal #5 from the read-only UX track (the research flagged it as the quick first win) — isolated to
config.rs/lib.rs, no overlap with the footer/filters work.Verification
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warnings+--no-default-featurescargo test --all-features— 760 passed / 0 failed, incl. a newprofiles_preserve_config_file_order_not_alphabeticallock test