Skip to content

Fix Export Tab leaking Enter via Command Palette - #20358

Merged
Dustin L. Howett (DHowett) merged 1 commit into
mainfrom
dev/cazamor/bugfix/export-text-enter
Jul 10, 2026
Merged

Dustin L. Howett (DHowett) merged 1 commit into
mainfrom
dev/cazamor/bugfix/export-text-enter

Conversation

@carlos-zamora

Copy link
Copy Markdown
Contributor

Summary of the Pull Request

Fixes a bug where Enter would leak into the terminal session when running the export buffer command from the command palette.

Turns out this is because _ExportTab() opens the file picker synchronously in the key handler. The file picker spins a nested Win32 modal message loop, which pumps the queued WM_CHAR into the terminal.

Switching to the foreground thread gets out of the nested modal loop, resulting in the WM_CHAR being handled through XAML's pipeline and suppressing it normally. The low priority makes it so that the command palette is visibly dismissed before opening the file picker.

Validation Steps Performed

Run export buffer action from the command palette.
✅ Enter does not go through to the underlying terminal.

PR Checklist

Closes #20188
Based on #20221

@DHowett Dustin L. Howett (DHowett) moved this from To Consider to To Cherry Pick in 1.24 Servicing Pipeline Jul 10, 2026
@DHowett Dustin L. Howett (DHowett) moved this from To Consider to To Cherry Pick in 1.25 Servicing Pipeline Jul 10, 2026
@DHowett
Dustin L. Howett (DHowett) merged commit 0144184 into main Jul 10, 2026
20 checks passed
@DHowett
Dustin L. Howett (DHowett) deleted the dev/cazamor/bugfix/export-text-enter branch July 10, 2026 20:47
@DHowett Dustin L. Howett (DHowett) moved this from To Cherry Pick to Cherry Picked in 1.24 Servicing Pipeline Jul 10, 2026
@DHowett Dustin L. Howett (DHowett) moved this from To Cherry Pick to Cherry Picked in 1.25 Servicing Pipeline Jul 10, 2026
Dustin L. Howett (DHowett) pushed a commit that referenced this pull request Jul 10, 2026
## Summary of the Pull Request
Fixes a bug where Enter would leak into the terminal session when
running the export buffer command from the command palette.

Turns out this is because `_ExportTab()` opens the file picker
synchronously in the key handler. The file picker spins a nested Win32
modal message loop, which pumps the queued `WM_CHAR` into the terminal.

Switching to the foreground thread gets out of the nested modal loop,
resulting in the `WM_CHAR` being handled through XAML's pipeline and
suppressing it normally. The low priority makes it so that the command
palette is visibly dismissed before opening the file picker.

## Validation Steps Performed
Run export buffer action from the command palette.
✅ Enter does not go through to the underlying terminal.

## PR Checklist
Closes #20188
Based on #20221

(cherry picked from commit 0144184)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgwpi5g
Service-Version: 1.24
Dustin L. Howett (DHowett) pushed a commit that referenced this pull request Jul 10, 2026
## Summary of the Pull Request
Fixes a bug where Enter would leak into the terminal session when
running the export buffer command from the command palette.

Turns out this is because `_ExportTab()` opens the file picker
synchronously in the key handler. The file picker spins a nested Win32
modal message loop, which pumps the queued `WM_CHAR` into the terminal.

Switching to the foreground thread gets out of the nested modal loop,
resulting in the `WM_CHAR` being handled through XAML's pipeline and
suppressing it normally. The low priority makes it so that the command
palette is visibly dismissed before opening the file picker.

## Validation Steps Performed
Run export buffer action from the command palette.
✅ Enter does not go through to the underlying terminal.

## PR Checklist
Closes #20188
Based on #20221

(cherry picked from commit 0144184)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgwpi5c
Service-Version: 1.25
@DHowett Dustin L. Howett (DHowett) moved this from Cherry Picked to Shipped in 1.25 Servicing Pipeline Sep 8, 2026
Tarori (tarori) pushed a commit to tarori/terminal that referenced this pull request Sep 15, 2026
## Summary of the Pull Request
Fixes a bug where Enter would leak into the terminal session when
running the export buffer command from the command palette.

Turns out this is because `_ExportTab()` opens the file picker
synchronously in the key handler. The file picker spins a nested Win32
modal message loop, which pumps the queued `WM_CHAR` into the terminal.

Switching to the foreground thread gets out of the nested modal loop,
resulting in the `WM_CHAR` being handled through XAML's pipeline and
suppressing it normally. The low priority makes it so that the command
palette is visibly dismissed before opening the file picker.

## Validation Steps Performed
Run export buffer action from the command palette.
✅ Enter does not go through to the underlying terminal.

## PR Checklist
Closes microsoft#20188
Based on microsoft#20221

(cherry picked from commit 0144184)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgwpi5g
Service-Version: 1.24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

"Export text" action invoked from cmd paletter forwards Enter key

2 participants

Sponsor
SponsoredKunjungi sekarang
Promo