Skip to content

Preserve supplementary characters when PMC processes backspace - #7621

Merged
donnie-msft merged 3 commits into
NuGet:devfrom
bribrothers:dev-bribrothers-gb18030-pmc-backspace
Aug 21, 2026
Merged

donnie-msft merged 3 commits into
NuGet:devfrom
bribrothers:dev-bribrothers-gb18030-pmc-backspace

Conversation

@bribrothers

Copy link
Copy Markdown
Contributor

Bug

Fixes: NuGet/Home#15025

Description

Package Manager Console previously processed backspace one UTF-16 code unit at a time. For GB18030 supplementary characters represented by surrogate pairs, this could leave an unpaired surrogate in the console text or PowerShell input buffer.

This change removes a complete trailing surrogate pair in both buffers and adds an Apex regression test covering supplementary-plane GB18030 text in Package Manager Console.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

Treat a trailing UTF-16 surrogate pair as one character when Package Manager Console processes backspace, and add GB18030 supplementary-character coverage.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 7939797f-e35c-4ef3-8f8b-70e7881aad43
@bribrothers
bribrothers requested a review from a team as a code owner August 6, 2026 18:14
@dotnet-policy-service dotnet-policy-service Bot added the Community PRs created by someone not in the NuGet team label Aug 6, 2026
@bribrothers

Copy link
Copy Markdown
Contributor Author

@donnie-msft I migrated the GB18030 Package Manager Console fix from the internal trusted mirror as requested. Could you please review when you have a chance?

@bribrothers

Copy link
Copy Markdown
Contributor Author

@dotnet-policy-service agree company="Microsoft"

Drive the Package Manager Console through its Read-Host key input path so the test verifies supplementary-character deletion in both the host buffer and console display.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 970af390-b689-4d4b-895c-6a1ae2ebe3e2
martinrrm
martinrrm previously approved these changes Aug 18, 2026
zivkan
zivkan previously approved these changes Aug 19, 2026
donnie-msft
donnie-msft previously approved these changes Aug 20, 2026
@donnie-msft

Copy link
Copy Markdown
Contributor

I re-ran the Apex tests since the added test timed-out.
Even though they are optional tests, I'd like to see the added test execute/pass before merging.

@donnie-msft donnie-msft assigned donnie-msft and unassigned martinrrm Aug 20, 2026
@donnie-msft
donnie-msft dismissed stale reviews from zivkan, martinrrm, and themself via 44b48c5 August 21, 2026 05:26
@donnie-msft

Copy link
Copy Markdown
Contributor

Changed the Apex test to wait until the Package Manager Console is ready for each simulated keystroke. This prevents Enter from being dropped, so the test completes instead of timing out.

Locally, the new Apex test passed for me. Let's see if it does in CI.

@donnie-msft

Copy link
Copy Markdown
Contributor

Apex test passed.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community PRs created by someone not in the NuGet team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Package Manager Console corrupts supplementary Unicode characters on backspace

4 participants