Characters typed into terminal when switching to other windows/tabs #21007

Open
opened 2026-01-31 07:30:25 +00:00 by claunia · 1 comment
Owner

Originally created by @adam-azarchs on GitHub (Dec 21, 2023).

Windows Terminal version

1.18.3181.0

Windows build number

10.0.22631.0

Other Software

PowerShell 7.4.0 (from microsoft store)

Steps to reproduce

From the first open tab in Windows Terminal, Alt-tab or use the mouse to switch to another window, or another tab within Windows Terminal.

Expected Behavior

Nothing typed into the terminal

Actual Behavior

The first time I switch away, it writes a [ into the terminal. If I switch back, it writes O[, and if I tab out again it writes I[, and continues to do that if I tab in and out repeatedly, so I end up with something like [O[I[O[I[O[I[O[I[O[I[O[I[O[I[O[I in my terminal.

It's entirely possible that I (or my toddler) accidentally mashed some key combination to put the terminal in some unexpected mode; this would be the most likely explanation since neither Windows Terminal nor PowerShell have been updated recently, however I'm at a loss as to what exactly could have done this.

Originally created by @adam-azarchs on GitHub (Dec 21, 2023). ### Windows Terminal version 1.18.3181.0 ### Windows build number 10.0.22631.0 ### Other Software PowerShell 7.4.0 (from microsoft store) ### Steps to reproduce From the first open tab in Windows Terminal, Alt-tab or use the mouse to switch to another window, or another tab within Windows Terminal. ### Expected Behavior Nothing typed into the terminal ### Actual Behavior The first time I switch away, it writes a `[` into the terminal. If I switch back, it writes `O[`, and if I tab out again it writes `I[`, and continues to do that if I tab in and out repeatedly, so I end up with something like `[O[I[O[I[O[I[O[I[O[I[O[I[O[I[O[I` in my terminal. It's entirely possible that I (or my toddler) accidentally mashed some key combination to put the terminal in some unexpected mode; this would be the most likely explanation since neither Windows Terminal nor PowerShell have been updated recently, however I'm at a loss as to what exactly could have done this.
claunia added the Issue-BugArea-InputArea-VTNeeds-ReproProduct-Terminal labels 2026-01-31 07:30:25 +00:00
Author
Owner

@j4james commented on GitHub (Dec 23, 2023):

@adam-azarchs Those look like focus change escape sequences. If an application has requested focus notification, the terminal sends \e[O when it loses focus, and \e[I when it gains focus. But even if the terminal had been left with that mode enabled, I wouldn't have expected you to see anything in the shell - I would have thought PowerShell would just swallow those notifications quietly. So there's possibly something else going wrong here.

@ALameLlama I'm not sure what your problem is, but I don't think it's likely to be the same cause.

@j4james commented on GitHub (Dec 23, 2023): @adam-azarchs Those look like focus change escape sequences. If an application has requested focus notification, the terminal sends `\e[O` when it loses focus, and `\e[I` when it gains focus. But even if the terminal had been left with that mode enabled, I wouldn't have expected you to see anything in the shell - I would have thought PowerShell would just swallow those notifications quietly. So there's possibly something else going wrong here. @ALameLlama I'm not sure what your problem is, but I don't think it's likely to be the same cause.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21007