opentui icon indicating copy to clipboard operation
opentui copied to clipboard

fix: Ctrl+A/E navigate to line start/end instead of buffer

Open remorses opened this issue 2 weeks ago • 0 comments

The default keybindings for Ctrl+A and Ctrl+E in TextareaRenderable were incorrectly mapped to buffer-home and buffer-end (jumping to the start/end of the entire textarea). This PR changes them to line-home and line-end to match standard Emacs/readline behavior used in virtually all Unix shells and TUI applications.

This is the standard behavior:

  • Ctrl+A → beginning of current line
  • Ctrl+E → end of current line

This fix also resolves unexpected behavior on macOS terminals. Many terminal emulators (including Ghostty, iTerm2, Terminal.app, and Zed's integrated terminal) translate Cmd+Left and Cmd+Right into Ctrl+A and Ctrl+E respectively. This is because macOS GUI applications use Cmd+Left/Right for line navigation, so terminals map these to the equivalent Unix keybindings. With the previous incorrect mapping, pressing Cmd+Left would unexpectedly jump to the start of the entire textarea instead of just the current line.

Tested on both Ghostty and Zed terminal on macOS.

remorses avatar Nov 25 '25 10:11 remorses