[PR #16185] Add support for actions in fragments #30861

Closed
opened 2026-01-31 09:43:25 +00:00 by claunia · 0 comments
Owner

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

State: closed
Merged: Yes


Surprisingly easier than I thought this would be. ActionMap already supports layering (from defaults.json), so this basically re-uses a lot of that for fun and profit.

The trickiest bits:

  • In SettingsLoader::_parseFragment, I'm constructing a fake, empty JSON object, and taking only the actions out from the fragment, and stuffing them into this temp json. Then, I parse that as a globals object, and set that as the parent to the user settings file. That results in only the actions from the fragment being parsed before the user's actions.
  • In that same method, I'm also explicitly preventing the ActionMap (et al.) from parsing keys from these actions. We don't want fragments to be able to say "ctrl+f is clear buffer" or something like that. This required a bit of annoying plumbing.

Closes #16063
Tests added.
Docs need to be updated.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/16185 **State:** closed **Merged:** Yes --- Surprisingly easier than I thought this would be. ActionMap already supports layering (from defaults.json), so this basically re-uses a lot of that for fun and profit. The trickiest bits: * In `SettingsLoader::_parseFragment`, I'm constructing a fake, empty JSON object, and taking _only_ the actions out from the fragment, and stuffing them into this temp json. Then, I parse that as a globals object, and set _that_ as the parent to the user settings file. That results in _only_ the actions from the fragment being parsed before the user's actions. * In that same method, I'm also explicitly preventing the ActionMap (et al.) from parsing `keys` from these actions. We don't want fragments to be able to say "ctrl+f is clear buffer" or something like that. This required a bit of annoying plumbing. Closes #16063 Tests added. Docs need to be updated.
claunia added the pull-request label 2026-01-31 09:43:25 +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#30861