diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index b2c4320a..c24debd3 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Added + +- Added shell-style keybindings: `alt+b`/`alt+f` for word navigation, `ctrl+d` for delete character forward (when editor has text) ([#1043](https://github.com/badlogic/pi-mono/issues/1043) by [@jasonish](https://github.com/jasonish)) + ### Fixed - Empty array in package filter now disables all resources instead of falling back to manifest defaults ([#1044](https://github.com/badlogic/pi-mono/issues/1044)) diff --git a/packages/coding-agent/docs/keybindings.md b/packages/coding-agent/docs/keybindings.md index 660f1eec..99393dd6 100644 --- a/packages/coding-agent/docs/keybindings.md +++ b/packages/coding-agent/docs/keybindings.md @@ -23,8 +23,8 @@ Modifier combinations: `ctrl+shift+x`, `alt+ctrl+x`, `ctrl+shift+alt+x`, etc. | `cursorDown` | `down` | Move cursor down | | `cursorLeft` | `left` | Move cursor left | | `cursorRight` | `right` | Move cursor right | -| `cursorWordLeft` | `alt+left`, `ctrl+left` | Move cursor word left | -| `cursorWordRight` | `alt+right`, `ctrl+right` | Move cursor word right | +| `cursorWordLeft` | `alt+left`, `ctrl+left`, `alt+b` | Move cursor word left | +| `cursorWordRight` | `alt+right`, `ctrl+right`, `alt+f` | Move cursor word right | | `cursorLineStart` | `home`, `ctrl+a` | Move to line start | | `cursorLineEnd` | `end`, `ctrl+e` | Move to line end | | `pageUp` | `pageUp` | Scroll up by page | @@ -35,7 +35,7 @@ Modifier combinations: `ctrl+shift+x`, `alt+ctrl+x`, `ctrl+shift+alt+x`, etc. | Action | Default | Description | |--------|---------|-------------| | `deleteCharBackward` | `backspace` | Delete character backward | -| `deleteCharForward` | `delete` | Delete character forward | +| `deleteCharForward` | `delete`, `ctrl+d` | Delete character forward | | `deleteWordBackward` | `ctrl+w`, `alt+backspace` | Delete word backward | | `deleteWordForward` | `alt+d`, `alt+delete` | Delete word forward | | `deleteToLineStart` | `ctrl+u` | Delete to line start | diff --git a/packages/coding-agent/src/modes/interactive/components/custom-editor.ts b/packages/coding-agent/src/modes/interactive/components/custom-editor.ts index 5ec7b11b..bb1b29fe 100644 --- a/packages/coding-agent/src/modes/interactive/components/custom-editor.ts +++ b/packages/coding-agent/src/modes/interactive/components/custom-editor.ts @@ -61,8 +61,9 @@ export class CustomEditor extends Editor { if (this.getText().length === 0) { const handler = this.onCtrlD ?? this.actionHandlers.get("exit"); if (handler) handler(); + return; } - return; // Always consume + // Fall through to editor handling for delete-char-forward when not empty } // Check all other app actions diff --git a/packages/tui/CHANGELOG.md b/packages/tui/CHANGELOG.md index 7dd124c0..09133237 100644 --- a/packages/tui/CHANGELOG.md +++ b/packages/tui/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Added + +- Added `alt+b` and `alt+f` as alternative keybindings for word navigation (`cursorWordLeft`, `cursorWordRight`) and `ctrl+d` for `deleteCharForward` ([#1043](https://github.com/badlogic/pi-mono/issues/1043) by [@jasonish](https://github.com/jasonish)) + ## [0.50.1] - 2026-01-26 ## [0.50.0] - 2026-01-26 diff --git a/packages/tui/src/keybindings.ts b/packages/tui/src/keybindings.ts index f1939c26..2fbede96 100644 --- a/packages/tui/src/keybindings.ts +++ b/packages/tui/src/keybindings.ts @@ -68,15 +68,15 @@ export const DEFAULT_EDITOR_KEYBINDINGS: Required = { cursorDown: "down", cursorLeft: "left", cursorRight: "right", - cursorWordLeft: ["alt+left", "ctrl+left"], - cursorWordRight: ["alt+right", "ctrl+right"], + cursorWordLeft: ["alt+left", "ctrl+left", "alt+b"], + cursorWordRight: ["alt+right", "ctrl+right", "alt+f"], cursorLineStart: ["home", "ctrl+a"], cursorLineEnd: ["end", "ctrl+e"], pageUp: "pageUp", pageDown: "pageDown", // Deletion deleteCharBackward: "backspace", - deleteCharForward: "delete", + deleteCharForward: ["delete", "ctrl+d"], deleteWordBackward: ["ctrl+w", "alt+backspace"], deleteWordForward: ["alt+d", "alt+delete"], deleteToLineStart: "ctrl+u",