microsoft / microsoft/terminal

TermControl key down handling investigation and refactoring

Open
#4,031 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-TerminalControl Issue-Task Product-Terminal
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

In current TermControl implementation, KeyDown events are handled by PreviewKeyDown event. It uses Tunneling strategy and key down events will first be sent to XAML root element, which is TermControl.

SearchBoxControl is a child element of TermControl. Thus, key input events on SearchBoxControl will be sent to TermControl first. Now there is an early return check in TermControl::_KeyDownHandler, which prevents key inputs from Search Box to be processed by TermControl. But this is not a good implementation.

We need to think about using KeyDown instead of PreviewKeyDown event handler in TermControl, but we need to make sure this change won't break anything.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the TermControl::_KeyDownHandler and the SearchBoxControl event path described in the issue. Compare the current PreviewKeyDown tunneling behavior with handling KeyDown, then check all affected keyboard interactions to ensure SearchBoxControl input and existing TermControl shortcuts still work. Done means the event-handling approach is validated without regressions.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.