gemini-cli - ✅(Solved) Fix Backspace deletes whole word instead of single character (keybindings reversed) [2 pull requests, 1 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#25926Fetched 2026-04-25 06:22:16
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
2
Participants
Timeline (top)
cross-referenced ×2labeled ×1

Fix Action

Fixed

PR fix notes

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
  • Previous implementation tried to infer Ctrl+Backspace on Windows using environment heuristics (OS, WT_SESSION)
  • This was unreliable: cmd.exe and PowerShell send \b for plain backspace, causing unintended word deletion
  • Removed ctrl=true inference entirely
  • \b is now consistently treated as a normal backspace

Details

Related Issues

Fixes #25867 #25856 #25907 #25926 #25934

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

PR #25943: fix(cli-ui): add modifyOtherKeys fallback for Ctrl+Backspace word delete

Description (problem / solution / changelog)

Summary

The revert PR #25941 removed the Windows heuristic that incorrectly set ctrl=true for \b, which fixed the Backspace/Ctrl+Backspace swap bug. However, Ctrl+Backspace remained non-functional in terminals that use modifyOtherKeys (the fallback path when Kitty protocol is unavailable).

This adds code 8 to KITTY_CODE_MAP so that the modifyOtherKeys sequence \x1b[27;5;8~ is properly decoded as Ctrl+Backspace, restoring word deletion in environments like VSCode terminal and xterm.

Also reverted the merge of \b and \x7f back to separate branches for cleaner structure and future maintainability.

Related Issues

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.tsx (modified, +7/-2)
RAW_BUFFERClick to expand / collapse

What happened?

In Gemini CLI, the Backspace key does not behave correctly. Instead of deleting a single character, it deletes the entire word. Conversely, Ctrl+Backspace deletes only one character.

What did you expect to happen?

Backspace → delete 1 character Ctrl+Backspace → delete 1 word

Client information

  • CLI Version: 0.39.1
  • Git Commit: 4d73f3413
  • Session ID: 64c96cdb-47ce-4559-a44d-0f7840cff540
  • Operating System: win32 v20.15.1
  • Sandbox Environment: no sandbox
  • Model Version: gemini-3-flash-preview
  • Auth Type: oauth-personal
  • Memory Usage: 177.0 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 Backspace key issue in Gemini CLI may be related to keyboard protocol or terminal settings, and checking the terminal configuration or trying a different terminal could help resolve the issue.

Guidance

  • Verify the terminal settings to ensure that the Backspace key is correctly configured to delete a single character.
  • Try using a different terminal to see if the issue is specific to the current terminal or a more general problem with the Gemini CLI.
  • Check if there are any known issues or configuration options related to the Kitty Keyboard Protocol, which is currently listed as Unsupported.
  • Review the Gemini CLI documentation to see if there are any specific settings or workarounds for Backspace key behavior.

Notes

The issue may be specific to the win32 operating system or the Unknown terminal, and further investigation into the terminal settings or Gemini CLI configuration may be necessary to resolve the issue.

Recommendation

Apply workaround: Try using a different terminal or adjusting the terminal settings to see if the Backspace key behavior can be corrected, as the root cause of the issue is unclear.

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