[PR #6575] Use early returns in TermControl::_KeyHandler #26753

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

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

State: closed
Merged: Yes


Summary of the Pull Request

This PR changes TermControl::_KeyHandler to use early returns, which you can think of as "guard clauses".
This has the benefit of a reduced nesting level, easier to understand control flow and opens op the way to more complex conditions.

PR Checklist

  • Closes #xxx
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated
  • 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

Validation Steps Performed

Everything still works as expected.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/6575 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request This PR changes `TermControl::_KeyHandler` to use early returns, which you can think of as "guard clauses". This has the benefit of a reduced nesting level, easier to understand control flow and opens op the way to more complex conditions. ## PR Checklist * [ ] Closes #xxx * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] Tests added/passed * [ ] Requires documentation to be updated * [ ] 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 ## Validation Steps Performed Everything still works as expected.
claunia added the pull-request label 2026-01-31 09:17:56 +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#26753