-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling Nullable Profile Settings #7435
Comments
NAK on a special magic enum value for No matter what you name that enum value, if it is a string, somebody could name a directory after it and then wonder, "why does Terminal hate my directory named |
I disagree with some of these assertions of inconsistent behavior.
(2):
|
Ok, then at least with I tested
Profile "test" runs wsl.exe and does not snap on input. We can change the behavior to be that when you set these settings to null, you fall back to the compiled-in value (as you'd expect). But I still think that that's not the right move. A regular person does not know what the compiled-in value is. The user explicitly set something to null that is not nullable. I feel that that by definition is a type mismatch. As for |
I would not treat the schema as the source of truth. We've pretty consistently forgotten to update that with PRs, and we'll often do it half-assedly. This deserves a longer reply but that's the thoughts off the top of the dome. The case that's the most curious to me is the |
optional<GUID> _guid{ nullopt };
optional<wstring> _source{ nullopt };
optional<GUID> _connectionType;
optional<wstring> _schemeName;
optional<color> _defaultForeground;
optional<color> _defaultBackground;
optional<color> _selectionBackground;
optional<color> _cursorColor;
optional<wstring> _tabTitle;
optional<color> _tabColor;
optional<wstring> _startingDirectory;
optional<wstring> _backgroundImage;
optional<double> _backgroundImageOpacity;
optional<WUX::Media::Stretch> _backgroundImageStretchMode;
optional<tuple<WUX::HorizontalAlignment, WUX::VerticalAlignment>> _backgroundImageAlignment;
optional<TerminalControl::ScrollbarState> _scrollbarState;
optional<wstring> _icon;
optional<bool> _retroTerminalEffect;
From those, The ones that do make sense are the ones where there's some other value that the Termianl might use in the absence of a value in the Profile. I might be losing the track a bit.
That might be a bug in parsing strings with JsonUtils. I'd think that parsing null would set the |
Dustin and I discussed that we might be able to fix this with converting almost all (in addition to getting rid of the aforementioned optionals that aren't really optionals) |
Profile is now a WinRT object in the TerminalApp project. As with ColorScheme, all of the serialization logic is not exposed via the idl. TerminalSetingsModel will handle it when it's all moved over. I removed the "Get" and "Set" prefixes from all of the Profile functions. It just makes more sense to use the `GETSET_PROPERTY` macro to do most of the work for us. `CloseOnExitMode` is now an enum off of the Profile.idl. `std::optional<wstring>` got converted to `hstring` (as opposed to `IReference<hstring>`). `IReference<hstring>` is not valid to MIDL. ## References #7141 - Profile is a settings object #885 - this new settings object will be moved to a new TerminalSettingsModel project ## Validation Steps Performed - [x] Tests passed - [x] Deployment succeeded Closes #7435
🎉This issue was addressed in #7283, which has now been successfully released as Handy links: |
Related to...
Some settings in
Profile
arestd::optional
and others aren't. This leads to an inconsistent handling of setting the property tonull
in the JSON. Consider the following examples:"backgroundImage"
(std::optional<std::wstring>
)"snapOnInput"
(bool
)"startingDirectory"
(std::optional<std::wstring>
)"commandline"
(std::wstring
)From an implementation standpoint, it makes sense.
std:optional
s treatnull
as a meaningful value, whereas non-std::optional
s treat null as fall back.The problem here is 2-fold:
null
as a value, even though we dostartingDirectory
is particularly an example of this where it has a unique behavior fromnull
but is not in the schemanull
will consistently fallback or set the value.Proposed Implementation/Solution
Make none of the profile settings nullable. If the user...
We should also add a special enum value for
startingDirectory
to inherit from the process.From a Settings UI standpoint, it won't be possible to set settings to null either. So we should just purge null-ness as an option, and add specific enums for special behavior. Fallback and other special behavior must be represented in the Settings UI as their own button/option.
The text was updated successfully, but these errors were encountered: