[PR #10978] [MERGED] Only focus the active pane once initialization is complete #28338

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/10978
Author: @zadjii-msft
Created: 8/18/2021
Status: Merged
Merged: 8/24/2021
Merged by: @undefined

Base: mainHead: dev/migrie/b/6586-split-pane-focus


📝 Commits (5)

  • f3e3be9 This sorta works to solve #6586
  • 86eeadd This fixes some fallout issues
  • b0f37ee Comments, i'm not a barbarian
  • aa274c8 Merge remote-tracking branch 'origin/main' into dev/migrie/b/6586-split-pane-focus
  • f2e0881 Merge remote-tracking branch 'origin/main' into dev/migrie/b/6586-split-pane-focus

📊 Changes

2 files changed (+17 additions, -7 deletions)

View changed files

📝 src/cascadia/TerminalApp/TerminalPage.cpp (+13 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+4 -7)

📄 Description

Summary of the Pull Request

Since the days immemorial of the Terminal, the TermControl has auto-focused itself when it finalizes its layout. This has led to the problem that wt ; sp ; sp ; sp... ends up focusing one of these panes at random.

This PR fixes this issue by getting rid of the auto-focusing. Panes now manually get focused when created. We manually focus the active pane when a commandline is dispatched. since we're internally tracking "active" separate from "focused", this ends up working as you'd hope.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

I also had to turn the cursor off by default. Most TermControls would never get the LostFocus event, so their cursors would get left On, and that's not right.

Validation Steps Performed

I've run the following things a bunch of times to make sure they work:

  • wtd sp ; sp ; sp
  • wtd sp ; sp ; sp ; fp -t 0
  • newTab
  • splitPane
  • use the command palette to do the above as well

Where the result used to be random (cases 1 & 2), the result is exactly what you'd expect now.

It doesn't work at all for

wtd sp ; sp ; sp ; mf left

Presumably because we can't move-focus directionally during startup. However, that doesn't work today either, so it's not making it worse. Just highlights that single scenario doesn't work right.


🔄 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/10978 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 8/18/2021 **Status:** ✅ Merged **Merged:** 8/24/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/migrie/b/6586-split-pane-focus` --- ### 📝 Commits (5) - [`f3e3be9`](https://github.com/microsoft/terminal/commit/f3e3be98472fad45a22e28e95e4cc8b33c111aaf) This sorta works to solve #6586 - [`86eeadd`](https://github.com/microsoft/terminal/commit/86eeadd4cf067f1fe8b4998094cdca6afbaca040) This fixes some fallout issues - [`b0f37ee`](https://github.com/microsoft/terminal/commit/b0f37ee58d73bb6046865fff0553e3a28c11a301) Comments, i'm not a barbarian - [`aa274c8`](https://github.com/microsoft/terminal/commit/aa274c89571d19a09a80983ff6374059c0f113b0) Merge remote-tracking branch 'origin/main' into dev/migrie/b/6586-split-pane-focus - [`f2e0881`](https://github.com/microsoft/terminal/commit/f2e0881bb34f45a73ac23d84ea68683f46c28ba2) Merge remote-tracking branch 'origin/main' into dev/migrie/b/6586-split-pane-focus ### 📊 Changes **2 files changed** (+17 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+13 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+4 -7) </details> ### 📄 Description ## Summary of the Pull Request Since the days immemorial of the Terminal, the TermControl has auto-focused itself when it finalizes its layout. This has led to the problem that `wt ; sp ; sp ; sp...` ends up focusing one of these panes at random. This PR fixes this issue by getting rid of the auto-focusing. Panes now manually get focused when created. We manually focus the active pane when a commandline is dispatched. since we're internally tracking "active" separate from "focused", this ends up working as you'd hope. ## References ## PR Checklist * [x] Closes #6586 * [x] I work here * [ ] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments I also had to turn the cursor off by default. Most `TermControl`s would never get the `LostFocus` event, so their cursors would get left `On`, and that's not right. ## Validation Steps Performed I've run the following things a bunch of times to make sure they work: * `wtd sp ; sp ; sp` * `wtd sp ; sp ; sp ; fp -t 0` * `newTab` * `splitPane` * use the command palette to do the above as well Where the result used to be random (cases 1 & 2), the result is exactly what you'd expect now. It doesn't work at all for ``` wtd sp ; sp ; sp ; mf left ``` Presumably because we can't `move-focus` directionally during startup. However, that doesn't work _today_ either, so it's not making it worse. Just highlights that single scenario doesn't work right. --- <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:27:52 +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#28338