[PR #19314] Stop using Settings to shuttle IKeyBindings around #31793

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

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

State: closed
Merged: Yes


For some reason, we went real hard on an architecture where the settings object contained the key bindings handler for the terminal. To make this work, we had to wind it through tons of layers: TermControl, ControlInteractivity, ControlCore (which saved it on ControlSettings), ControlSettings. Of course, because we have no clear delineation of concerns at the App layer this required us to put the bindings into the Settings Cache1 .

Well, TermControl used ControlCore to get the Settings, to get the Bindings, to dispatch keys.

Yes, TermControl stored IKeyBindings down three layers only to fish it back out and use it itself.

There is one place in the application where TermControls are hooked up to their owners. Instead of passing the key bindings dispatcher in through nine hundred layers, we can just set it once--definitively!--there.


  1. This was the last thing that made the settings cache page-specific... ↩︎

**Original Pull Request:** https://github.com/microsoft/terminal/pull/19314 **State:** closed **Merged:** Yes --- For some reason, we went real hard on an architecture where the settings object contained the key bindings handler for the terminal. To make this work, we had to wind it through tons of layers: `TermControl`, `ControlInteractivity`, `ControlCore` (which saved it on `ControlSettings`), `ControlSettings`. Of course, because we have no clear delineation of concerns at the App layer this required us to put the bindings into the Settings Cache[^1]. Well, `TermControl` used `ControlCore` to get the Settings, to get the Bindings, to dispatch keys. Yes, `TermControl` stored `IKeyBindings` down three layers _only to fish it back out and use it itself._ There is one place in the application where `TermControl`s are hooked up to their owners. Instead of passing the key bindings dispatcher in through nine hundred layers, we can just set it once--definitively!--there. [^1]: This was the last thing that made the settings cache page-specific...
claunia added the pull-request label 2026-01-31 09:49:37 +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#31793