5366: delay scrolling / clear selection until the input sequence is created #7896
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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