gemini-cli - ✅(Solved) Fix Backspace deletes word instead of character on Windows [2 pull requests, 4 comments, 5 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25867Fetched 2026-04-24 06:13:47
View on GitHub
Comments
4
Participants
5
Timeline
9
Reactions
1
Timeline (top)
commented ×4cross-referenced ×2referenced ×2labeled ×1

Fix Action

Fixed

PR fix notes

PR #25881: fix(cli): restrict ctrl+backspace detection to Windows Terminal only

Description (problem / solution / changelog)

Summary

  • PR #21447 introduced ctrl+backspace word deletion for Windows, but the condition OS === 'Windows_NT' was too broad
  • cmd.exe and PowerShell send \b (0x08) for plain backspace, not \x7f — so they were incorrectly being treated as Ctrl+Backspace, deleting a whole word on every backspace press
  • Fixed by scoping ctrl=true to WT_SESSION only (Windows Terminal), which is the only terminal that sends \b for Ctrl+Backspace and \x7f for plain backspace
  • Updated the test that expected OS=Windows_NT alone to set ctrl=true

Fixes #25867

Test plan

  • Windows Terminal (WT_SESSION set): Ctrl+Backspace deletes word, plain backspace deletes one character
  • cmd.exe / PowerShell (no WT_SESSION): plain backspace deletes one character (regression from #21447 is fixed)
  • Linux/macOS: behavior unchanged

Changed files

  • packages/cli/src/ui/contexts/KeypressContext.test.tsx (modified, +2/-2)
  • packages/cli/src/ui/contexts/KeypressContext.tsx (modified, +4/-6)

PR #25882: fix(cli): restrict ctrl+backspace detection to Windows Terminal only

Description (problem / solution / changelog)

Summary

  • PR #21447 introduced ctrl+backspace word deletion for Windows, but the condition OS === 'Windows_NT' was too broad
  • cmd.exe and PowerShell send \b (0x08) for plain backspace, not \x7f — so they were incorrectly being treated as Ctrl+Backspace, deleting a whole word on every backspace press
  • Fixed by scoping ctrl=true to WT_SESSION only (Windows Terminal), which is the only terminal that sends \b for Ctrl+Backspace and \x7f for plain backspace
  • Updated the test that expected OS=Windows_NT alone to set ctrl=true

Details

Related Issues

Fixes #25867 #25856

How to Validate

Pre-Merge Checklist

<!-- Check all that apply before requesting review or merging. -->
  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

Changed files

  • packages/cli/src/ui/contexts/KeypressContext.test.tsx (modified, +2/-2)
  • packages/cli/src/ui/contexts/KeypressContext.tsx (modified, +4/-6)
RAW_BUFFERClick to expand / collapse

What happened?

Backspace deletes word instead of character on Windows

What did you expect to happen?

You know

Client information

  • CLI Version: 0.39.0
  • Git Commit: 398f78dca
  • Session ID: b2832a45-8f66-425d-b209-e6f0db0bb215
  • Operating System: win32 v20.9.0
  • Sandbox Environment: no sandbox
  • Model Version: gemini-3-flash-preview
  • Auth Type: oauth-personal
  • Memory Usage: 113.5 MB
  • Terminal Name: Unknown
  • Terminal Background: #0c0c0c
  • Kitty Keyboard Protocol: Unsupported

Login information

No response

Anything else we need to know?

No response

extent analysis

TL;DR

The issue might be resolved by checking the keyboard settings or terminal configuration to ensure that the backspace key is correctly mapped to delete a character instead of a word.

Guidance

  • Verify the keyboard layout and settings in the operating system to ensure that the backspace key is functioning as expected.
  • Check the terminal emulator settings to see if there are any custom key bindings that might be causing the backspace key to delete a word instead of a character.
  • Investigate if the issue is specific to the CLI version (0.39.0) or if it occurs in other versions as well.
  • Consider testing the backspace key behavior in a different terminal emulator to isolate the issue.

Notes

The issue seems to be specific to the Windows operating system (win32 v20.9.0), and the Kitty Keyboard Protocol is listed as unsupported, which might be relevant to the problem.

Recommendation

Apply workaround: Check and adjust keyboard and terminal settings to ensure correct backspace key behavior, as the issue might be related to the specific environment or configuration rather than a version-specific bug.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING