[PR #4807] Tunnel F7 keypresses directly into special handlers in TermControl #25956

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

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

State: closed
Merged: Yes


The Xaml input stack doesn't allow an application to suppress the "caret
browsing" dialog experience triggered when you press F7.

The official recommendation from the Xaml team is to catch F7 before we
hand it off.

This commit introduces a special F7 handler and an ad-hoc implementation of event bubbling.
Runtime classes implementing a custom IF7Listener interface are
considered during a modified focus parent walk to determine who can
handle F7 specifically.

If the recipient control handles F7, we suppress the message completely.

This event bubbler has some minor issues -- the search box will not be
able to receive F7 because its parent control implements the handler.
Since search is already mostly a text box, it doesn't need special
caret browsing functionality as far as I can tell.

TermControl implements its OnF7Pressed handler by synthesizing a
keybindings event and an event to feed into Terminal Core directly.

It's not possible to create a synthetic KeyPressRoutedEvent; if it were,
I would have just popped one into the traditional input queue. :)

Fixes #638.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/4807 **State:** closed **Merged:** Yes --- The Xaml input stack doesn't allow an application to suppress the "caret browsing" dialog experience triggered when you press F7. The official recommendation from the Xaml team is to catch F7 before we hand it off. This commit introduces a special F7 handler and an ad-hoc implementation of event bubbling. Runtime classes implementing a custom IF7Listener interface are considered during a modified focus parent walk to determine who can handle F7 specifically. If the recipient control handles F7, we suppress the message completely. This event bubbler has some minor issues -- the search box will not be able to receive F7 because its parent control implements the handler. Since search is already mostly a text box, it doesn't _need_ special caret browsing functionality as far as I can tell. TermControl implements its OnF7Pressed handler by synthesizing a keybindings event and an event to feed into Terminal Core directly. It's not possible to create a synthetic KeyPressRoutedEvent; if it were, I would have just popped one into the traditional input queue. :) Fixes #638.
claunia added the pull-request label 2026-01-31 09:12:53 +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#25956