Skip to content

Input bar editing shortcuts — select all, clear line (Ctrl+U), and clear entire prompt #1785

@berrat

Description

@berrat

Describe the feature or problem you'd like to solve

The input bar lacks standard text editing shortcuts that users expect from any modern terminal or text editor. There is no way to select all input text, kill an entire line, or clear the whole prompt in one keystroke. Users writing long or complex prompts have to manually hold Backspace or repeatedly use Ctrl+W (delete word) — a slow and frustrating experience.

Proposed solution

Add the following standard editing shortcuts to the input bar, consistent with readline/shell conventions:

Shortcut Action
Ctrl+A Move cursor to beginning of line (readline standard)
Ctrl+E Move cursor to end of line (readline standard)
Ctrl+U Delete from cursor to beginning of line (kill-line backward)
Ctrl+K Delete from cursor to end of line (kill-line forward)
Ctrl+Shift+U Clear the entire multi-line prompt at once

These are standard readline/Emacs keybindings already familiar to terminal users. At minimum, Ctrl+U (kill to start of line) and a full-clear shortcut (Ctrl+Shift+U) are the most critical missing pieces.

Note on conflicts: Some of these bindings may overlap with existing terminal or OS shortcuts depending on the environment (e.g. Ctrl+K in some terminals). The implementation should check for conflicts and skip or allow user remapping where needed. Alt+Backspace is intentionally excluded here as it was fixed in 0.0.417 to correctly act as a word-delete shortcut and should remain so.

Example prompts or workflows

  1. User types a long multi-line prompt, realises it's wrong, hits Ctrl+Shift+U — entire input cleared instantly, ready to retype.
  2. User is mid-line, cursor in the middle — Ctrl+U clears back to the start of the current line, Ctrl+K clears forward to the end.
  3. User navigates to beginning/end of line with Ctrl+A / Ctrl+E without reaching for the Home/End keys.
  4. Experienced shell users get the muscle-memory readline behaviour they already know from bash/zsh.

Additional context

  • OS: Windows 11 Pro (Build 26200 / 24H2)
  • Shell: PowerShell 7.5.4
  • Copilot CLI: 0.0.420 (win32-x64)
  • Ctrl+W (delete word backward) and Alt+Backspace (delete word, fixed in 0.0.417) already work — these shortcuts complete the standard readline editing set.
  • Ctrl+G (open in external editor, added in 0.0.419) already exists — these shortcuts are the complement for users who prefer to stay in-line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions