[PR #9949] Make Actions page editable #27824

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

Original Pull Request: https://github.com/microsoft/terminal/pull/9949

State: closed
Merged: Yes


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

**Original Pull Request:** https://github.com/microsoft/terminal/pull/9949 **State:** closed **Merged:** Yes --- ## 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)
claunia added the pull-request label 2026-01-31 09:24:30 +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#27824