[PR #5706] Allow the default profile to be specified by name #26430

Open
opened 2026-01-31 09:16:03 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/5706

State: closed
Merged: Yes


Summary of the Pull Request

This looks like a big diff, but there's a bunch of existing code that
just got moved around, and there's a cool new Utils template.

The tests all pass, and this passed manual validation. I tried weird
things like "making a profile named { }"
(w/ enough spaces to look like a guid), and yeah it doesn't let you
specify that one as a name, but why would you do that?!

Okay, this pull request abstracts the conversion of a profile name into
an optional profile guid out of the "New Terminal Tab Args" handler and
into a common space for all of CascadiaSettings to use.

It also cleans up the conversion of indices and names into optional
GUIDs and turns those into further helpers.

It also introduces a cool new template for running value_or multiple
times on a chain of optionals. CoalesceOptionals is a "choose first,
with fallback" for N>1 optionals.

On top of all this, I've built support for an "unparsed default GUID":
we load the user's defaultProfile as a string, and as part of settings
validation we unpack that string using the helpers outlined above.

References

Couples well with #5690.

PR Checklist

Validation Steps Performed

Added additional test collateral to make sure that this works.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/5706 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request This looks like a big diff, but there's a bunch of existing code that just got moved around, and there's a cool new Utils template. The tests all pass, and this passed manual validation. I tried weird things like "making a profile named `{ }`" (w/ enough spaces to look like a guid), and yeah it doesn't let you specify that one as a name, but _why would you do that?!_ Okay, this pull request abstracts the conversion of a profile name into an optional profile guid out of the "New Terminal Tab Args" handler and into a common space for all of CascadiaSettings to use. It also cleans up the conversion of indices and names into optional GUIDs and turns _those_ into further helpers. It also introduces a cool new template for running value_or multiple times on a chain of optionals. CoalesceOptionals is a "choose first, with fallback" for N>1 optionals. On top of all this, I've built support for an "unparsed default GUID": we load the user's defaultProfile as a string, and as part of settings validation we unpack that string using the helpers outlined above. ## References Couples well with #5690. ## PR Checklist * [x] Incidentally fixes #2876 * [x] Core Contributor * [x] Tests added/passed * [x] Requires documentation to be updated (done) * [x] I've discussed this with core contributors already ## Validation Steps Performed Added additional test collateral to make sure that this works.
claunia added the pull-request label 2026-01-31 09:16:03 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26430