-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Allow editing actions in the settings UI #18917
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
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…ettings_actions_editor
carlos-zamora
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other feedback:
- "Clear buffer" action is being shown as "Clear mark" (binding to ctrl+shift+k shown correctly)
carlos-zamora
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be really nice if you added a comment by each of the ArgWrapper data templates saying what's a good action type and arg combo to test this out. I've been manually going through ActionArgs.h to figure this out. Not the end of the world, but it'd be a nice QOL improvement 😁
Almost done reviewing this. Just need to go over ActionsViewModel
| Grid.Row="3" | ||
| Grid.Column="0" | ||
| VerticalAlignment="Center" /> | ||
| <ListView Grid.Row="3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider ItemsRepeater instead of ListView. We're not using the functionality of the ListView, really. We just want a stack panel layout of our own controls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ItemsControl works too. I used it over in my extensions page:
| <ItemsControl x:Name="ActiveExtensionsList" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do use ListView.Header which neither ItemsRepeater nor ItemsControl have, we could mimic it with a Grid or something but might as well just use ListView.Header I think
carlos-zamora
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright! Finally finished reviewing everything. Left a bunch of comments all around. Tried to test things out with the bug bash build as I went and did some accessibility testing too. I recommend that after you get the accessibility stuff in, you run it through Accessibility Insights' FastPass to check for common issues. That said, I think once you fix the comments I added in, you should be pretty much good to go there.
There's a bit more cacheing that can be done. I think it's worth it since we've got A TON of commands/actions. There was also a concern I had about null-checking somewhere in there so we probably want to fix that.
The ArgsWrapper stuff is really cool. Good work all-around dude 😊. Excited to see this land when you make the changes. We're close!
| std::vector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> enumList; \ | ||
| const auto mappings = winrt::Microsoft::Terminal::Settings::Model::EnumMappings::enumMappingsName(); \ | ||
| enumType unboxedValue; \ | ||
| auto nullEntry = winrt::make<winrt::Microsoft::Terminal::Settings::Editor::implementation::EnumEntry>(RS_(L"Actions_NullEnumValue"), nullptr); \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhere I mentioned that we should provide a more specific string for the null value. Looks like this is the spot to do it. You can probably just move the resource ID into the macro definition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are only two nullable args here that this applies to - CopyFormatting (in CopyText) and TabSwitcherMode (in PrevTab/NextTab) and setting those args to null means the same for both of them: follow the global setting. Any ideas for the more specific string for either?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being able to deduce the value and show what the global setting is would be cool, but I'm not gonna block over that. It's good as is.
| // unboxing functions | ||
| winrt::hstring UnboxString(const Windows::Foundation::IInspectable& value); | ||
| winrt::hstring UnboxGuid(const Windows::Foundation::IInspectable& value); | ||
| int32_t UnboxInt32(const Windows::Foundation::IInspectable& value); | ||
| float UnboxInt32Optional(const Windows::Foundation::IInspectable& value); | ||
| uint32_t UnboxUInt32(const Windows::Foundation::IInspectable& value); | ||
| float UnboxUInt32Optional(const Windows::Foundation::IInspectable& value); | ||
| float UnboxUInt64(const Windows::Foundation::IInspectable& value); | ||
| float UnboxFloat(const Windows::Foundation::IInspectable& value); | ||
| bool UnboxBool(const Windows::Foundation::IInspectable& value); | ||
| winrt::Windows::Foundation::IReference<bool> UnboxBoolOptional(const Windows::Foundation::IInspectable& value); | ||
| winrt::Windows::Foundation::IReference<Microsoft::Terminal::Core::Color> UnboxTerminalCoreColorOptional(const Windows::Foundation::IInspectable& value); | ||
| winrt::Windows::Foundation::IReference<Microsoft::Terminal::Core::Color> UnboxWindowsUIColorOptional(const Windows::Foundation::IInspectable& value); | ||
|
|
||
| // bind back functions | ||
| void StringBindBack(const winrt::hstring& newValue); | ||
| void GuidBindBack(const winrt::hstring& newValue); | ||
| void Int32BindBack(const double newValue); | ||
| void Int32OptionalBindBack(const double newValue); | ||
| void UInt32BindBack(const double newValue); | ||
| void UInt32OptionalBindBack(const double newValue); | ||
| void UInt64BindBack(const double newValue); | ||
| void FloatBindBack(const double newValue); | ||
| void BoolOptionalBindBack(const Windows::Foundation::IReference<bool> newValue); | ||
| void TerminalCoreColorBindBack(const winrt::Windows::Foundation::IReference<Microsoft::Terminal::Core::Color> newValue); | ||
| void WindowsUIColorBindBack(const winrt::Windows::Foundation::IReference<Microsoft::Terminal::Core::Color> newValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are all pretty simple functions, and that's great. Would there be any benefit to moving these over to be converters so they can be used throughout the project? Or am I overengineering it? 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The BindBack functions all need to stay here since it involves modifying the underlying data, so I figured it would be cleaner if we just leave the Unbox functions here too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to move just the unbox ones over to converters if we feel strongly about it though
…/pabhoj/settings_model_reflection
…ettings_actions_editor
|
Oh! Also add in the "New" badge. You should be able to add it like the same way I did for the Extensions page. Just look at |
| String UnboxString(Object value); | ||
| UInt32 UnboxInt32(Object value); | ||
| Single UnboxInt32Optional(Object value); | ||
| UInt32 UnboxUInt32(Object value); | ||
| Single UnboxUInt32Optional(Object value); | ||
| Single UnboxUInt64(Object value); | ||
| Single UnboxFloat(Object value); | ||
| Boolean UnboxBool(Object value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these need to be exposed? Same for the pack functions below. Perhaps others are also not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep they need to be exposed for xaml to bind to, since in this case the bindings are being done in data templates
…/pabhoj/settings_actions_editor
2e8c282 to
e0352e4
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| String FlagName { get; }; | ||
| IInspectable FlagValue { get; }; | ||
| Int32 IntValue { get; }; | ||
| Boolean IsSet; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Careful! EnumEntries are immutable (and can be cached and reused across the settings model) but this makes it seem like FlagEntries are not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, FlagEntries allow the flag to be switched on/off, would it help if I rename it so it doesn't mislead us into thinking it should be immutable like EnumEntries? Otherwise we would need 2 FlagEntries per flag value, one for on and one for off
DHowett
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
18/27
DHowett
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
22/22! Minor open questions and nits, but overall looking very very good. Well done :)
| SelectionMode="None" /> | ||
| <!-- Commands --> | ||
| <ListView x:Name="CommandsListView" | ||
| Margin="-8,0,0,0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why -8? What does this look like when terminal is as narrow as possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| void FloatBindBack(Double newValue); | ||
| void BoolOptionalBindBack(Windows.Foundation.IReference<Boolean> newValue); | ||
| void TerminalCoreColorBindBack(Windows.Foundation.IReference<Microsoft.Terminal.Core.Color> newValue); | ||
| void WindowsUIColorBindBack(Windows.Foundation.IReference<Microsoft.Terminal.Core.Color> newValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both the forward and backward bindings for "WindowsUIColor" use Microsoft.Terminal.Core.Color (!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's because we use the NullableColorPicker, which only understands Terminal.Core.Color. So the point of these unboxing/bindback functions is to translate between WindowsUIColor and TerminalCoreColor
| void ArgWrapper::UInt32BindBack(const double newValue) | ||
| { | ||
| if (UnboxUInt32(_Value) != newValue) | ||
| { | ||
| Value(box_value(static_cast<uint32_t>(newValue))); | ||
| } | ||
| } | ||
|
|
||
| void ArgWrapper::UInt32OptionalBindBack(const double newValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI these two take doubles!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! Xaml's NumberBox isn't happy with other number types, so all of these take doubles and the unbox/bindback functions handle the logic according to what the underlying type actually is/should be
…/pabhoj/settings_actions_editor

The actions page now has a list of all the commands (default, user, fragments etc) and clicking a command from that page brings you to an "Edit action" page where you can fully view and edit both the action type and any additional arguments.
Detailed Description of the Pull Request / Additional comments
Actions View Model
CommandViewModel(view model for aCommand), a list of these is created and managed byActionsViewModelActionArgsViewModel(view model for anActionArgs), created and managed byCommandViewModelArgWrapper(view model for each individual argument inside anActionArgs), created and managed byActionArgsViewModelActions page
EditAction page
CommandViewModelValidation Steps Performed
Bug bashed
PR Checklist