[PR #11430] Fix default terminal setting dropdown #28570

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

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

State: closed
Merged: Yes


WinUI/XAML requires the SelectedItem to be member of the list of
ItemsSource. CascadiaSettings::DefaultTerminals() is such an ItemsSource
and is called every time the launch settings page is visited.
It calls DefaultTerminal::Available() which in turn calls Refresh().
While the SelectedItem was cached in CascadiaSettings, the value of
DefaultTerminals() wasn't. Thus every time the page was visited, it refreshed
the ItemsSource list without invalidating the current SelectedItem.

This commit prevents such accidental mishaps from occurring in the future,
by moving the responsibility of caching solely to the CascadiaSettings class.

PR Checklist

Validation Steps Performed

  • Navigating between SUI pages maintains the current dropdown selection ✔️
  • Saving the settings saves the correct terminal at HKCU:\Console\%%Startup ✔️
**Original Pull Request:** https://github.com/microsoft/terminal/pull/11430 **State:** closed **Merged:** Yes --- WinUI/XAML requires the `SelectedItem` to be member of the list of `ItemsSource`. `CascadiaSettings::DefaultTerminals()` is such an `ItemsSource` and is called every time the launch settings page is visited. It calls `DefaultTerminal::Available()` which in turn calls `Refresh()`. While the `SelectedItem` was cached in `CascadiaSettings`, the value of `DefaultTerminals()` wasn't. Thus every time the page was visited, it refreshed the `ItemsSource` list without invalidating the current `SelectedItem`. This commit prevents such accidental mishaps from occurring in the future, by moving the responsibility of caching solely to the `CascadiaSettings` class. ## PR Checklist * [x] Closes #11424 * [x] I work here * [x] Tests added/passed ## Validation Steps Performed * Navigating between SUI pages maintains the current dropdown selection ✔️ * Saving the settings saves the correct terminal at `HKCU:\Console\%%Startup` ✔️
claunia added the pull-request label 2026-01-31 09:29:20 +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#28570