[PR #11430] [MERGED] Fix default terminal setting dropdown #28565

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/11430
Author: @lhecker
Created: 10/6/2021
Status: Merged
Merged: 10/6/2021
Merged by: @undefined

Base: mainHead: dev/lhecker/11424-fix-default-terminal


📝 Commits (2)

  • 1c70688 Fix default terminal setting dropdown
  • 1b8ecde Move construct pair values

📊 Changes

7 files changed (+56 additions, -75 deletions)

View changed files

📝 .github/actions/spelling/expect/expect.txt (+3 -2)
📝 src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp (+22 -15)
📝 src/cascadia/TerminalSettingsModel/CascadiaSettings.h (+3 -1)
📝 src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp (+1 -2)
📝 src/cascadia/TerminalSettingsModel/DefaultTerminal.cpp (+25 -40)
📝 src/cascadia/TerminalSettingsModel/DefaultTerminal.h (+2 -12)
📝 src/cascadia/TerminalSettingsModel/DefaultTerminal.idl (+0 -3)

📄 Description

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 ✔️

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/11430 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 10/6/2021 **Status:** ✅ Merged **Merged:** 10/6/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/lhecker/11424-fix-default-terminal` --- ### 📝 Commits (2) - [`1c70688`](https://github.com/microsoft/terminal/commit/1c70688e200358351f733b21713342fc36ff618f) Fix default terminal setting dropdown - [`1b8ecde`](https://github.com/microsoft/terminal/commit/1b8ecded50dc963138dbb29be7d7557f3799a3b4) Move construct pair values ### 📊 Changes **7 files changed** (+56 additions, -75 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/spelling/expect/expect.txt` (+3 -2) 📝 `src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp` (+22 -15) 📝 `src/cascadia/TerminalSettingsModel/CascadiaSettings.h` (+3 -1) 📝 `src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp` (+1 -2) 📝 `src/cascadia/TerminalSettingsModel/DefaultTerminal.cpp` (+25 -40) 📝 `src/cascadia/TerminalSettingsModel/DefaultTerminal.h` (+2 -12) 📝 `src/cascadia/TerminalSettingsModel/DefaultTerminal.idl` (+0 -3) </details> ### 📄 Description 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` ✔️ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:29:19 +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#28565