fix(cli): restrict ctrl+backspace detection to Windows Terminal only - #25881
fix(cli): restrict ctrl+backspace detection to Windows Terminal only#25881dogukanozen wants to merge 1 commit into
Conversation
The previous fix (google-gemini#21447) treated OS=Windows_NT as sufficient to mark \b as Ctrl+Backspace, but cmd.exe and PowerShell also send \b for plain backspace, causing every backspace to delete a whole word on those terminals. Scope the ctrl=true path to WT_SESSION only (Windows Terminal), which is the terminal that actually sends \b for Ctrl+Backspace and \x7f for plain backspace. Update the corresponding test expectation. Fixes google-gemini#25867 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a regression in input handling for Windows users. By narrowing the scope of Ctrl+Backspace detection to specifically target Windows Terminal sessions, the change ensures that standard terminal emulators like cmd.exe and PowerShell maintain correct backspace behavior, preventing accidental word deletion. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refines the handling of the backspace character (\b) in Windows environments within the KeypressContext. The logic now specifically checks for the WT_SESSION environment variable to identify Windows Terminal, ensuring that \b is only treated as Ctrl+Backspace in that context, while standard consoles like cmd.exe and PowerShell treat it as a regular backspace. The associated test case has been updated to verify this behavior. I have no feedback to provide.
Summary
ctrl+backspaceword deletion for Windows, but the conditionOS === 'Windows_NT'was too broadcmd.exeandPowerShellsend\b(0x08) for plain backspace, not\x7f— so they were incorrectly being treated asCtrl+Backspace, deleting a whole word on every backspace pressctrl=truetoWT_SESSIONonly (Windows Terminal), which is the only terminal that sends\bforCtrl+Backspaceand\x7ffor plain backspaceOS=Windows_NTalone to setctrl=trueFixes #25867
Test plan
WT_SESSIONset):Ctrl+Backspacedeletes word, plain backspace deletes one characterWT_SESSION): plain backspace deletes one character (regression from fix(cli-ui): enable Ctrl+Backspace for word deletion in Windows Terminal #21447 is fixed)