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\)
// 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 = _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.

_fixupsAppliedDuringLoad |= ... looks a bit easier on the eye IMO.

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

2 participants