[PR #7896] 5366: delay scrolling / clear selection until the input sequence is created #27020

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

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

State: closed
Merged: No


Summary of the Pull Request

Right now the decisions to clear text selection or to scroll down is triggered too early, before we even decided to handle the event at all. This PR is an attempt to delay this decision until TermControl gets notified about input sequence.

References

PR Checklist

  • Closes #https://github.com/microsoft/terminal/issues/5366
  • CLA signed.
  • Tests added/passed - not added yet
  • Documentation updated - irrelevant
  • Schema updated - irrelevant
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

So this one should be very simple: don't invoke selection clearing / scrolling immediately, but rather in the TermControl once a sequence received from the callback.

What confused me was that delaying the decision was not enough: there are sequences that we do send to the connection that actually don't require scrolling / clearing selection. For instance Print Screen key is sent to the connection, but no action should be taken on Terminal side.

So I still had to preserve the safeguards that exist today. The problem is that to preserve these safeguards, TermControl should be aware of the stuff like was it key-up / key-down, etc. Though this information can be decoded from the sequence I decided to propagate the IInputEvent all the way through. This required some massive change of function prototypes.

Validation Steps Performed

  • Manual tests only by now
**Original Pull Request:** https://github.com/microsoft/terminal/pull/7896 **State:** closed **Merged:** No --- <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Right now the decisions to clear text selection or to scroll down is triggered too early, before we even decided to handle the event at all. This PR is an attempt to delay this decision until TermControl gets notified about input sequence. <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #https://github.com/microsoft/terminal/issues/5366 * [x] CLA signed. * [ ] Tests added/passed - not added yet * [ ] Documentation updated - irrelevant * [ ] Schema updated - irrelevant * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments So this one should be very simple: don't invoke selection clearing / scrolling immediately, but rather in the TermControl once a sequence received from the callback. What confused me was that delaying the decision was not enough: there are sequences that we do send to the connection that actually don't require scrolling / clearing selection. For instance Print Screen key is sent to the connection, but no action should be taken on Terminal side. So I still had to preserve the safeguards that exist today. The problem is that to preserve these safeguards, TermControl should be aware of the stuff like was it key-up / key-down, etc. Though this information can be decoded from the sequence I decided to propagate the IInputEvent all the way through. This required some massive change of function prototypes. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed * Manual tests only by now
claunia added the pull-request label 2026-01-31 09:19:31 +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#27020