Skip to content

feat: readline prompts#22

Merged
guodong-sq merged 2 commits intoblock:mainfrom
bezhermoso:fix/install-readline-input
Feb 23, 2026
Merged

feat: readline prompts#22
guodong-sq merged 2 commits intoblock:mainfrom
bezhermoso:fix/install-readline-input

Conversation

@bezhermoso
Copy link
Contributor

Problem

Interactive prompts in the installer and supporting libraries used read -rp without the -e flag. The terminal's line discipline (cooked mode) handles basic editing like backspace, but read without -e does not engage readline — so these features don't work:

  • Tab completion — can't complete filesystem paths while typing
    repo roots, worktree directories, symlink paths, etc.
  • Arrow key navigation — ← / → don't move the cursor; ↑ / ↓ don't
    recall history
  • Readline shortcuts — Ctrl+W (delete word), Ctrl+A/E
    (jump to start/end), etc.

This is especially noticeable for the path prompts in the setup flow, where Tab completion is the natural way to navigate deep directory trees.

Fix

Add -e to all interactive read -p calls. -e hands input to readline, enabling full line-editing and completion support.

#!/usr/bin/env bash is used throughout, so the bash-specific -e
flag is always available.

Files changed:

  • lib/wt-commonprompt_confirm
  • lib/wt-context-setup — 10 prompts (repo path, context name, config fields, free-form input, numeric selection)
  • lib/wt-choose — worktree selection prompt
  • lib/wt-context — context selection prompt

bezhermoso and others added 2 commits February 22, 2026 17:36
`read -rp` without `-e` reads raw bytes, so backspace sends a literal
DEL/BS character into the buffer instead of erasing the previous
character. Arrow keys and other editing keys have the same problem.

Adding `-e` enables readline line-editing for both prompt helpers:
- `prompt_with_default` in install.sh
- `prompt_confirm` in lib/wt-common

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends the `read -rp` → `read -erp` fix to all interactive prompts
that were added/refactored in main but missed in the original fix:

- lib/wt-context-setup: 10 prompts (repo path, context name, config
  fields, freeform input, numeric selection)
- lib/wt-choose: worktree selection prompt
- lib/wt-context: context selection prompt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@guodong-sq guodong-sq merged commit 68a154e into block:main Feb 23, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants