gemini-cli - ✅(Solved) Fix Incorrect backspace behaviour [2 pull requests, 9 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#25856Fetched 2026-04-24 06:14:00
View on GitHub
Comments
9
Participants
5
Timeline
14
Reactions
2
Timeline (top)
commented ×9cross-referenced ×2labeled ×1mentioned ×1

Fix Action

Fixed

PR fix notes

PR #25862: fix(cli): correct backspace handling in Windows Terminal

Description (problem / solution / changelog)

Summary

Fix incorrect backspace handling in Windows Terminal.

In some Windows Terminal setups, normal Backspace could be treated like Ctrl+Backspace, causing it to delete the previous word instead of a single character.

Details

This change narrows the Windows fallback that interprets raw \b as Ctrl+Backspace. The fallback is now disabled in Windows Terminal (WT_SESSION) and remains available only for non-Windows-Terminal Windows consoles where that behavior may still be needed.

Regression coverage was also added for the Windows Terminal case.

Related Issues

Fixes #25856

How to Validate

  1. Run the targeted test:
    npm --workspace @google/gemini-cli test -- src/ui/contexts/KeypressContext.test.tsx
  2. In Windows Terminal, run the CLI and type some text with a typo.
  3. Press Backspace and confirm it deletes a single character.
  4. Press Ctrl+Backspace and confirm it does not cause normal Backspace to be treated as word-delete.
  5. Confirm the Windows Terminal regression test passes.

Pre-Merge Checklist

  • 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, +47/-2)
  • packages/cli/src/ui/contexts/KeypressContext.tsx (modified, +9/-3)

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?

Hello, I ran gemini-cli from the VS Code terminal, which found and installed a new release, version 0.39.0. Once the update was complete, I ran gemini-cli again and noticed that pressing the Backspace key on the keyboard performed the same function as Ctrl+Backspace, i.e. it deleted the entire previous word instead of just the last letter.

What did you expect to happen?

I expected only the last letter to be deleted, not a whole word.

Client information

  • CLI Version: 0.39.0
  • Git Commit: 398f78dca
  • Session ID: b4150a3f-64c7-442f-b3a4-42be66fdda6b
  • Operating System: win32 v22.13.1
  • Sandbox Environment: no sandbox
  • Model Version: gemini-3-flash-preview
  • Auth Type: oauth-personal
  • Memory Usage: 237.8 MB
  • Terminal Name: xterm.js(6.1.0-beta.197)
  • Terminal Background: #282c34
  • Kitty Keyboard Protocol: Supported
  • IDE Client: VS Code

Login information

No response

Anything else we need to know?

No response

extent analysis

TL;DR

The issue can likely be resolved by checking the keyboard settings or configuration in the VS Code terminal or the gemini-cli tool to ensure that the Backspace key is not mapped to the Ctrl+Backspace function.

Guidance

  • Verify the keyboard shortcuts in the VS Code terminal settings to ensure that the Backspace key is not overridden.
  • Check the gemini-cli documentation or configuration options to see if there are any settings related to keyboard input or Backspace behavior.
  • Test the Backspace key in a different terminal or environment to determine if the issue is specific to the VS Code terminal or gemini-cli.
  • Consider resetting the gemini-cli configuration to its default settings to see if the issue persists.

Notes

The issue may be related to a change in the gemini-cli tool or the VS Code terminal settings, but without further information, it is difficult to determine the exact cause.

Recommendation

Apply workaround: Check and adjust the keyboard settings in the VS Code terminal and gemini-cli tool to ensure that the Backspace key functions as expected.

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

gemini-cli - ✅(Solved) Fix Incorrect backspace behaviour [2 pull requests, 9 comments, 5 participants]