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

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/4807
Author: @DHowett-MSFT
Created: 3/5/2020
Status: Merged
Merged: 3/5/2020
Merged by: @undefined

Base: masterHead: dev/duhowtt/f7


📝 Commits (3)

  • 96c73ea Tunnel F7 keypresses directly into special handlers in TermControl
  • 6595a65 Well, i should add the actual idl
  • 7eb8d16 Do a comment

📊 Changes

11 files changed (+133 additions, -2 deletions)

View changed files

📝 src/cascadia/TerminalApp/AppLogic.cpp (+35 -0)
📝 src/cascadia/TerminalApp/AppLogic.h (+1 -0)
📝 src/cascadia/TerminalApp/AppLogic.idl (+2 -1)
src/cascadia/TerminalApp/IF7Listener.idl (+16 -0)
📝 src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj (+1 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+32 -0)
📝 src/cascadia/TerminalControl/TermControl.h (+2 -0)
📝 src/cascadia/TerminalControl/TermControl.idl (+12 -1)
📝 src/cascadia/WindowsTerminal/AppHost.cpp (+9 -0)
📝 src/cascadia/WindowsTerminal/AppHost.h (+1 -0)
📝 src/cascadia/WindowsTerminal/main.cpp (+22 -0)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/4807 **Author:** [@DHowett-MSFT](https://github.com/DHowett-MSFT) **Created:** 3/5/2020 **Status:** ✅ Merged **Merged:** 3/5/2020 **Merged by:** [@undefined](undefined) **Base:** `master` ← **Head:** `dev/duhowtt/f7` --- ### 📝 Commits (3) - [`96c73ea`](https://github.com/microsoft/terminal/commit/96c73eaa37229d4a4a334d99afc55522561ee770) Tunnel F7 keypresses directly into special handlers in TermControl - [`6595a65`](https://github.com/microsoft/terminal/commit/6595a656f6b81369100693949b83b0846131606b) Well, i should add the actual idl - [`7eb8d16`](https://github.com/microsoft/terminal/commit/7eb8d16782f71e39626179f21965301616af8bdd) Do a comment ### 📊 Changes **11 files changed** (+133 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/AppLogic.cpp` (+35 -0) 📝 `src/cascadia/TerminalApp/AppLogic.h` (+1 -0) 📝 `src/cascadia/TerminalApp/AppLogic.idl` (+2 -1) ➕ `src/cascadia/TerminalApp/IF7Listener.idl` (+16 -0) 📝 `src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj` (+1 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+32 -0) 📝 `src/cascadia/TerminalControl/TermControl.h` (+2 -0) 📝 `src/cascadia/TerminalControl/TermControl.idl` (+12 -1) 📝 `src/cascadia/WindowsTerminal/AppHost.cpp` (+9 -0) 📝 `src/cascadia/WindowsTerminal/AppHost.h` (+1 -0) 📝 `src/cascadia/WindowsTerminal/main.cpp` (+22 -0) </details> ### 📄 Description 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#25952