[PR #9949] [MERGED] Make Actions page editable #27819

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/9949
Author: @carlos-zamora
Created: 4/26/2021
Status: Merged
Merged: 5/18/2021
Merged by: @undefined

Base: mainHead: dev/cazamor/actions-page/foundation


📝 Commits (6)

  • ed9ec6d Make Actions page editable
  • 8964dd1 address review and most bug bash feedback
  • 883c9aa bugfix: show conflict flyout when enter pressed
  • df944d8 add a bit more polish from DHowett
  • eded0a4 address PR feedback from Leon
  • 3c0852e Merge branch 'main' into dev/cazamor/actions-page/foundation

📊 Changes

13 files changed (+850 additions, -190 deletions)

View changed files

📝 src/cascadia/TerminalSettingsEditor/Actions.cpp (+275 -23)
📝 src/cascadia/TerminalSettingsEditor/Actions.h (+71 -13)
📝 src/cascadia/TerminalSettingsEditor/Actions.idl (+38 -4)
📝 src/cascadia/TerminalSettingsEditor/Actions.xaml (+260 -95)
📝 src/cascadia/TerminalSettingsEditor/CommonResources.xaml (+1 -1)
📝 src/cascadia/TerminalSettingsEditor/MainPage.cpp (+1 -8)
📝 src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw (+45 -1)
📝 src/cascadia/TerminalSettingsEditor/SettingContainer.h (+0 -21)
📝 src/cascadia/TerminalSettingsEditor/Utils.h (+21 -0)
📝 src/cascadia/TerminalSettingsEditor/ViewModelHelpers.h (+17 -0)
📝 src/cascadia/TerminalSettingsModel/ActionMap.cpp (+110 -23)
📝 src/cascadia/TerminalSettingsModel/ActionMap.h (+7 -0)
📝 src/cascadia/TerminalSettingsModel/ActionMap.idl (+4 -1)

📄 Description

Summary of the Pull Request

This PR lays the foundation for a new Actions page in the Settings UI as designed in #6900. The Actions page now leverages the ActionMap to display all of the key bindings and allow the user to modify the associated key chord or delete the key binding entirely.

References

#9621 - ActionMap
#9926 - ActionMap serialization
#9428 - ActionMap Spec
#6900 - Actions page
#9427 - Actions page design doc

Detailed Description of the Pull Request / Additional comments

Settings Model Changes

  • Command::Copy() now copies the ActionAndArgs
  • ActionMap::RebindKeys() handles changing the key chord of a key binding. If a conflict occurs, the conflicting key chord is overwritten.
  • ActionMap::DeleteKeyBinding() "deletes" a key binding by binding "unbound" to the given key chord.
  • ActionMap::KeyBindings() presents another view (similar to NameMap) of the ActionMap. It specifically presents a map of key chords to commands. It is generated similar to how NameMap is generated.

Editor Changes

  • Actions.xaml is mainly split into two parts:
    • ListView (as before) holds the list of key bindings. We could explore the idea of an items repeater, but the ListView seems to provide some niceties with regards to navigating the list via the key board (though none are selectable).
    • DataTemplate is used to represent each key binding inside the ListView. This is tricky because it is bound to a KeyBindingViewModel which must provide all context necessary to modify the UI and the settings model. We cannot use names to target UI elements inside this template, so we must make the view model smart and force updates to the UI via changes in the view model.
  • KeyBindingViewModel is a view model object that controls the UI and the settings model.

There are a number of TODOs in Actions.cpp will be long-term follow-ups and would be nice to have. This includes...

  • a binary search by name on Actions::KeyBindingList
  • presenting an error when the provided key chord is invalid.

Demo

Actions Page Demo


🔄 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/9949 **Author:** [@carlos-zamora](https://github.com/carlos-zamora) **Created:** 4/26/2021 **Status:** ✅ Merged **Merged:** 5/18/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/cazamor/actions-page/foundation` --- ### 📝 Commits (6) - [`ed9ec6d`](https://github.com/microsoft/terminal/commit/ed9ec6dd3194c2139779cc5a1b81e81ee3571cae) Make Actions page editable - [`8964dd1`](https://github.com/microsoft/terminal/commit/8964dd1e198b7ccce663c9ce94b78f57260fd23b) address review and most bug bash feedback - [`883c9aa`](https://github.com/microsoft/terminal/commit/883c9aa52694ae0a186a1f4b687a580f26ca5110) bugfix: show conflict flyout when enter pressed - [`df944d8`](https://github.com/microsoft/terminal/commit/df944d856ae795e1b83c7522a5b7c0c89363f389) add a bit more polish from DHowett - [`eded0a4`](https://github.com/microsoft/terminal/commit/eded0a46c2cc644920b27e6a6712621729796de9) address PR feedback from Leon - [`3c0852e`](https://github.com/microsoft/terminal/commit/3c0852e0170707f4fa51753596464b9eadd29e56) Merge branch 'main' into dev/cazamor/actions-page/foundation ### 📊 Changes **13 files changed** (+850 additions, -190 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalSettingsEditor/Actions.cpp` (+275 -23) 📝 `src/cascadia/TerminalSettingsEditor/Actions.h` (+71 -13) 📝 `src/cascadia/TerminalSettingsEditor/Actions.idl` (+38 -4) 📝 `src/cascadia/TerminalSettingsEditor/Actions.xaml` (+260 -95) 📝 `src/cascadia/TerminalSettingsEditor/CommonResources.xaml` (+1 -1) 📝 `src/cascadia/TerminalSettingsEditor/MainPage.cpp` (+1 -8) 📝 `src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw` (+45 -1) 📝 `src/cascadia/TerminalSettingsEditor/SettingContainer.h` (+0 -21) 📝 `src/cascadia/TerminalSettingsEditor/Utils.h` (+21 -0) 📝 `src/cascadia/TerminalSettingsEditor/ViewModelHelpers.h` (+17 -0) 📝 `src/cascadia/TerminalSettingsModel/ActionMap.cpp` (+110 -23) 📝 `src/cascadia/TerminalSettingsModel/ActionMap.h` (+7 -0) 📝 `src/cascadia/TerminalSettingsModel/ActionMap.idl` (+4 -1) </details> ### 📄 Description ## Summary of the Pull Request This PR lays the foundation for a new Actions page in the Settings UI as designed in #6900. The Actions page now leverages the `ActionMap` to display all of the key bindings and allow the user to modify the associated key chord or delete the key binding entirely. ## References #9621 - ActionMap #9926 - ActionMap serialization #9428 - ActionMap Spec #6900 - Actions page #9427 - Actions page design doc ## Detailed Description of the Pull Request / Additional comments ### Settings Model Changes - `Command::Copy()` now copies the `ActionAndArgs` - `ActionMap::RebindKeys()` handles changing the key chord of a key binding. If a conflict occurs, the conflicting key chord is overwritten. - `ActionMap::DeleteKeyBinding()` "deletes" a key binding by binding "unbound" to the given key chord. - `ActionMap::KeyBindings()` presents another view (similar to `NameMap`) of the `ActionMap`. It specifically presents a map of key chords to commands. It is generated similar to how `NameMap` is generated. ### Editor Changes - `Actions.xaml` is mainly split into two parts: - `ListView` (as before) holds the list of key bindings. We _could_ explore the idea of an items repeater, but the `ListView` seems to provide some niceties with regards to navigating the list via the key board (though none are selectable). - `DataTemplate` is used to represent each key binding inside the `ListView`. This is tricky because it is bound to a `KeyBindingViewModel` which must provide _all_ context necessary to modify the UI and the settings model. We cannot use names to target UI elements inside this template, so we must make the view model smart and force updates to the UI via changes in the view model. - `KeyBindingViewModel` is a view model object that controls the UI and the settings model. There are a number of TODOs in Actions.cpp will be long-term follow-ups and would be nice to have. This includes... - a binary search by name on `Actions::KeyBindingList` - presenting an error when the provided key chord is invalid. ## Demo ![Actions Page Demo](https://user-images.githubusercontent.com/11050425/116034988-131d1b80-a619-11eb-8df2-c7e57c6fad86.gif) --- <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:24:28 +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#27819