Where to find the code that maps a shortcut to string #20360

Closed
opened 2026-01-31 07:11:23 +00:00 by claunia · 4 comments
Owner

Originally created by @brupelo on GitHub (Aug 12, 2023).

Where can I find the specific code used in the actions editor when assigning shortcuts?

vzWUkzVK5X

I'm curious and I'd like to learn how this is done behind the curtains because it behaves quite differently to other shortcut editors, for instance:

On a text editor:

  • If I press '+' it prints '+'
  • If I press shift + '+' prints '*'
  • If I press altgr + '+' prints ']'

On a the wt action editor on the other hand:

  • If I press '+' it prints 'plus'
  • If I press shift + '+' prints 'shift+plus'
  • If I press altgr + '+' prints 'ctrl+alt+plus'

Similar thing happens with all the keys

Originally created by @brupelo on GitHub (Aug 12, 2023). Where can I find the specific code used in the actions editor when assigning shortcuts? ![vzWUkzVK5X](https://github.com/microsoft/terminal/assets/18058492/28b2a7b6-706e-4f41-a886-5746eeb4347d) I'm curious and I'd like to learn how this is done behind the curtains because it behaves quite differently to other shortcut editors, for instance: On a text editor: - If I press '+' it prints '+' - If I press shift + '+' prints '*' - If I press altgr + '+' prints ']' On a the wt action editor on the other hand: - If I press '+' it prints 'plus' - If I press shift + '+' prints 'shift+plus' - If I press altgr + '+' prints 'ctrl+alt+plus' Similar thing happens with all the keys
claunia added the Needs-TriageNeeds-Tag-Fix labels 2026-01-31 07:11:24 +00:00
Author
Owner

@brupelo commented on GitHub (Aug 12, 2023):

Btw, I was testing the functionality and I've noticed some little bug in the actions editor, ie:

WindowsTerminal_OGCu73zoxF

You shouldn't be able to see the edit icon unless you're hovering with the mouse but in some cases where you've started editing an action and didn't complete it you'll be to leave the widget in an inconsistent state

@brupelo commented on GitHub (Aug 12, 2023): Btw, I was testing the functionality and I've noticed some little bug in the actions editor, ie: ![WindowsTerminal_OGCu73zoxF](https://github.com/microsoft/terminal/assets/18058492/d87e60b4-3dd4-4a77-af65-c9183e7bee3d) You shouldn't be able to see the edit icon unless you're hovering with the mouse but in some cases where you've started editing an action and didn't complete it you'll be to leave the widget in an inconsistent state
Author
Owner

@zadjii-msft commented on GitHub (Aug 14, 2023):

I'd reckon it's somewhere around here:
a0c88bb511/src/cascadia/TerminalSettingsEditor/Actions.cpp (L88-L95)

Though, the serialization is all done in this file: https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalSettingsModel/KeyChordSerialization.cpp

I think we've got some bug laying around here with "AltGR is wacky in the settings json sometimes"... very possibly #10218

@zadjii-msft commented on GitHub (Aug 14, 2023): I'd reckon it's somewhere around here: https://github.com/microsoft/terminal/blob/a0c88bb5117b8062cee4c4cad934a60e72768eb1/src/cascadia/TerminalSettingsEditor/Actions.cpp#L88-L95 Though, the serialization is all done in this file: https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalSettingsModel/KeyChordSerialization.cpp I think we've got some bug laying around here with "AltGR is wacky in the settings json sometimes"... very possibly #10218
Author
Owner

@brupelo commented on GitHub (Aug 14, 2023):

@zadjii-msft Thanks! I love this issue tracker, you guys are really responsive and helpful, I'll take a look 😉

In addition, I must say I find extremely nice the way you guys coded the action editor, it's extremely intuitive in comparison to many other shortcut editors out there. The only thing I'd say I'm missing would be having some sort of real-time filtering that you can find in tools like blender, ie:

blender_xvzySneH5e

On the other hand, maybe this is just me being extra picky as there are not so many available actions like in complex software like blender, plus i can see you guys are already sorting by name so it's really intuitive to add/edit actions. So maybe an extra filtering would just add unnecesary complexity. Also, I like the choice you did by allowing to assign multiple shortcuts to the same action

WindowsTerminal_kmPyOeEnXM

Of course, you're checking if a shortcut is already assigned and give the option to overwrite, so you're making sure to avoid inconsistent behaviour.

Anyway, as I said, thanks!

@brupelo commented on GitHub (Aug 14, 2023): @zadjii-msft Thanks! I love this issue tracker, you guys are really responsive and helpful, I'll take a look 😉 In addition, I must say I find extremely nice the way you guys coded the action editor, it's extremely intuitive in comparison to many other shortcut editors out there. The only thing I'd say I'm missing would be having some sort of real-time filtering that you can find in tools like blender, ie: ![blender_xvzySneH5e](https://github.com/microsoft/terminal/assets/18058492/445cf12b-0547-4034-aaf7-a834b22be388) On the other hand, maybe this is just me being extra picky as there are not so many available actions like in complex software like blender, plus i can see you guys are already sorting by name so it's really intuitive to add/edit actions. So maybe an extra filtering would just add unnecesary complexity. Also, I like the choice you did by allowing to assign multiple shortcuts to the same action ![WindowsTerminal_kmPyOeEnXM](https://github.com/microsoft/terminal/assets/18058492/2ed476b9-6ff4-48fd-a3ae-8044cdff752b) Of course, you're checking if a shortcut is already assigned and give the option to overwrite, so you're making sure to avoid inconsistent behaviour. Anyway, as I said, thanks!
Author
Owner

@zadjii-msft commented on GitHub (Aug 14, 2023):

The only thing I'd say I'm missing would be having some sort of real-time filtering

pretty sure we're tracking this in #11630 😉

@zadjii-msft commented on GitHub (Aug 14, 2023): > The only thing I'd say I'm missing would be having some sort of real-time filtering pretty sure we're tracking this in #11630 :wink:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20360