microsoft / microsoft/terminal

Terminal flashes when running a command that opens up scripts in new tabs

Open
#14,605 4 comments 0 reactions 0 assignees View on GitHub
Area-DefApp Issue-Bug Product-Terminal
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

### Windows Terminal version

1.15.3466.0

### Windows build number

10.0.22621.0

### Steps to reproduce

1. Set "New instance behaviour" setting to "Attach to most recently window on this desktop".
2. Open two tabs (say Tab 1 and Tab 2).
3. In Tab 1, run any command that runs a script in a new terminal. Minimal example: run `start powershell {echo hello}`.
4. Observe that you are now in Tab 2.

### Expected Behavior

I would expect the tab initiating a command to keep focus. (i.e., I would expect that Tab 1 would remain focussed)

### Actual Behavior

Minimal example:

https://user-images.githubusercontent.com/47859223/209470441-6c5bb94e-8c98-4907-a4cc-9c77c59e5fd2.mp4

Observe that I initiate the command in Tab 1, but I end up in Tab 2.

-------

To get a real feeling of when this behaviour is incredibly annoying, run a command that launches many terminals. Then you get the "flashing" behaviour mentioned in the title of this issue.

I'm using `nx` as a build tool, which constantly opens up new terminals to run subscripts. Observe:

https://user-images.githubusercontent.com/47859223/209470449-41c284a5-0d49-4bfd-bf98-ab76cfe66ae9.mp4

The observed behaviour is that this command opens a new tab which immediately gets the focus, then closes within a matter of milliseconds, as a consequence focussing on the last tab of the terminal instead of the initial one. This is repeated several times.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with “New instance behaviour” set to “Attach to most recently window on this desktop,” two tabs open, and `start powershell {echo hello}` run from Tab 1. Observe whether focus moves to Tab 2 or flashes through tabs when commands such as nx launch multiple terminals. Done means the initiating tab keeps focus after the command opens and closes new terminals.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, powershell
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.