Skip to content

Conversation

@carlos-zamora
Copy link
Member

Summary of the Pull Request

Updates the "firstWindowPreference" global setting to take 3 values: "defaultProfile", "persistedLayout", and "persistedLayoutAndContent".

The legacy "persistedWindowLayout" is being interpreted as "persistedLayoutAndContent".

The tricky part here is that we need to maintain support for the legacy value as persisting the layout and content, even though the value's name suggests that it should just support the layout and no content. To get around this, I added "persistedLayout" and "persistedLayoutAndContent".

The enum map is manually constructed for FirstWindowPreference to exclude the deprecated value. This prevents the legacy value from leaking into the settings UI.

Functionally, the change to serialize the contents is simple. WindowEmperor::_persistState()'s second parameter is used to serialize the buffer. Rather than having it set to true, we set it to GlobalSettings().FirstWindowPreference() == FirstWindowPreference::PersistedLayoutAndContent.

Validation Steps Performed

✅ "persistedWindowLayout" is changed to "persistedLayoutAndContent"

Closes #18757

_logSettingSet(LegacyForceVTInputKey);
}

// GLOBAL_SETTINGS_LAYER_JSON above should've already loaded this value properly.

Check failure

Code scanning / check-spelling

Unrecognized Spelling

[should've](#security-tab) is not a recognized word. \(unrecognized-spelling\)
@carlos-zamora carlos-zamora enabled auto-merge (squash) October 27, 2025 19:21
@carlos-zamora carlos-zamora merged commit 16f7ab4 into main Oct 27, 2025
19 checks passed
Comment on lines +456 to +460
<value>Open windows from a previous session (layout and content)</value>
<comment>An option to choose from for the "First window preference" setting. Reopen the layouts from the last session and preserve the content.</comment>
</data>
<data name="Globals_FirstWindowPreferencePersistedLayout.Content" xml:space="preserve">
<value>Open windows from a previous session (layout only)</value>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's workshop these names before we send them off to the loc team ;P

// We just need to detect if the legacy value was used and mark it for fixup, if so.
if (const auto firstWindowPreferenceValue = json[FirstWindowPreferenceKey.data()])
{
_fixupsAppliedDuringLoad |= firstWindowPreferenceValue == LegacyPersistedWindowLayout.data();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wow - we've never done a fixup for a legacy key like this!

<comment>An option to choose from for the "First window preference" setting. Reopen the layouts from the last session.</comment>
</data>
<data name="Globals_FirstWindowPreferencePersistedLayoutAndContent.Content" xml:space="preserve">
<value>Open windows from a previous session (layout and content)</value>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe "Restore window layout" and "Restore window layout and content"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add another session option that prevents saving (or loading) buffer contents

4 participants