Skip to content

fix(chat): bind opt+backspace and ctrl+backspace to delete-word-backward - #697

Merged
edenreich merged 1 commit into
mainfrom
fix/689-opt-backspace-delete-word
Jun 30, 2026
Merged

edenreich merged 1 commit into
mainfrom
fix/689-opt-backspace-delete-word

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Summary

In the chat TUI input, opt+backspace (macOS) / alt+backspace and ctrl+backspace no longer deleted the previous word — only ctrl+w did. This restores the readline/macOS convention.

Closes #689

Root cause

The chat input is a custom InputView (introduced in the Charm UI v2 migration, #576), driven by the keybinding registry rather than a native bubbles textarea. The delete_word_backward action carried over only ctrl+w. An unbound alt+backspace flows ProcessKey → handleSingleKey, fails registry.Resolve, and falls through to handleCharacterInput, where keys.CanInputHandle returns false (not in InputHandlerKeys, no printable text) — so it is a no-op.

Verified in the Bubble Tea v2 / ultraviolet source that keyMsg.String() emits exactly "alt+backspace" (Keystroke() prepends alt+; keyTypeString[KeyBackspace] = "backspace"), so binding the key dispatches the existing handleDeleteWordBackward handler.

Changes

  • internal/ui/keybinding/actions.go — registry default for delete_word_backward: ctrl+w → ctrl+w, alt+backspace, ctrl+backspace.
  • config/keybindings.go — the config default (GetDefaultKeybindings) kept in sync. This is the effective binding for normal sessions: ApplyConfigOverrides runs by default (Chat.Keybindings.Enabled = true) and full-replaces an action's keys, so both default sources must agree.
  • internal/ui/keybinding/registry_test.go — TestDeleteWordBackwardBindings asserts both default paths (registry default and the config-override path that mirrors chat startup), guarding the two-source sync.
  • docs/configuration-reference.md — macOS terminal note ("Use Option as Meta key").

ctrl+backspace is included for cross-platform parity (word-delete convention on Windows/Linux); no existing binding/conflict, harmless where a terminal doesn't emit it. No change to InputHandlerKeys/CanInputHandle is needed — the registry resolves and dispatches the key before that fallback.

Testing

  • task build ✓
  • task test (full suite) ✓
  • task lint (golangci-lint 0 issues + markdownlint) ✓

Manual: ./infer chat, type hello world foo, press opt+backspace → hello world (word deleted); ctrl+w still deletes a word.

Note for users

Anyone with an existing keybindings.yaml from a prior infer init has delete_word_backward pinned to ctrl+w only; that file overrides the new default. They can pick up the new keys with infer keybindings reset (or by re-generating the file). Fresh installs and the in-code defaults get them immediately.

opt+backspace (alt+backspace) and ctrl+backspace no longer deleted the previous word in the chat input - only ctrl+w did. The custom InputView from the Charm UI v2 migration (#576) is driven by the keybinding registry, and the delete_word_backward action carried over only ctrl+w.

Bind the keys in both default sources - the registry default (actions.go) and the config default (GetDefaultKeybindings), which is applied as a full-replace override when keybindings are enabled, so both stay in sync. Add a regression test covering both paths and a macOS terminal-config note to the docs.

Closes #689
@edenreich
edenreich requested a review from a team as a code owner June 30, 2026 16:39
@edenreich
edenreich merged commit 173fe83 into main Jun 30, 2026
1 check passed
@edenreich
edenreich deleted the fix/689-opt-backspace-delete-word branch June 30, 2026 16:47
inference-gateway-releaser Bot added a commit that referenced this pull request Jun 30, 2026
## [0.126.0](v0.125.0...v0.126.0) (2026-06-30)

### 🚀 Features

* add persistent memory tool for agent ([#679](#679)) ([a487b13](a487b13))
* **agent:** interactive subagent management and unified background-work tracking ([#684](#684)) ([343e083](343e083))

### 🐛 Bug Fixes

* **chat:** bind opt+backspace and ctrl+backspace to delete-word-backward ([#697](#697)) ([173fe83](173fe83)), closes [#689](#689) [#576](#576)
* **a2a:** retain completed background tasks in /tasks ([#691](#691)) ([#701](#701)) ([43b8e13](43b8e13))
* **autocomplete:** surface arguments for one-of/all-optional tool schemas ([#698](#698)) ([655b2e4](655b2e4))

### ♻️ Code Refactoring

* add .gitignore by default to the projects dir ([4717deb](4717deb))
* enable memory by default ([86c2158](86c2158))
* make infer config userspace-first ([#682](#682)) ([1e77e42](1e77e42)), closes [#680](#680)
* **tui:** single event-loop ingress - one notifier, no self-rescheduling pollers ([#700](#700)) ([2ab8854](2ab8854))
* standardize comment punctuation by replacing em dashes with hyphens ([78f53a8](78f53a8))

### 📚 Documentation

* fix docs/ drift found by the README-to-codebase audit ([#687](#687)) ([413047a](413047a)), closes [#572](#572) [#686](#686)
* sync README and reference docs with the codebase ([#685](#685)) ([c328423](c328423)), closes [#572](#572) [#684](#684) [#684](#684)

### 👷 CI/CD

* **deps:** update CLAUDE workflow to version 0.14.5 ([eaba2b3](eaba2b3))

### 🧹 Maintenance

* add .infer to .gitignore ([08ef319](08ef319))
* **deps:** bump infer CLI v0.124.0 -> v0.125.0, infer-action v0.19.0 -> v0.19.1 ([#681](#681)) ([e9e7e21](e9e7e21))
* remove agent definitions ([4f7fd7d](4f7fd7d))
* remove unused configuration and shortcut files ([4c611db](4c611db))
* update claude-code to 2.1.191 ([729e81c](729e81c))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.126.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] opt+backspace (alt+backspace) no longer deletes the previous word in chat input

1 participant