Skip to content

feat(vault-tui): readline text-input editing + bracketed paste#9

Merged
UnbreakableMJ merged 1 commit into
mainfrom
tui-text-input
Jun 14, 2026
Merged

feat(vault-tui): readline text-input editing + bracketed paste#9
UnbreakableMJ merged 1 commit into
mainfrom
tui-text-input

Conversation

@UnbreakableMJ

Copy link
Copy Markdown
Contributor

Summary

The TUI's / search, : command line, and every add/edit form field were append/backspace-only Strings — no cursor, no paste. They now share a TextInput { buf, cursor } with real readline-style line editing (PRD §7.2 Bindings). TUI-only — no protocol, agent, CLI, or dependency changes (crossterm 0.28 already exposes the paste API).

What's new

  • Cursor editing: //Home/End (+ Ctrl+A/Ctrl+E), Delete at the cursor, insert anywhere — fix a mid-word typo without deleting back to it. The caret renders where edits land (gi▌t), not just at the end.
  • Kill/yank into a shared kill-ring: Ctrl+W (word back), Ctrl+U (to start), Ctrl+K (to end), Ctrl+Y (yank).
  • Bracketed paste (EnableBracketedPaste + Event::Paste): paste from the system clipboard — including over SSH/tmux — at the cursor; newlines stripped (every input is single-line).
  • Ctrl+S submits the add/edit form (PRD §7.2 save). On the form's Type row //Space still toggle login⇄note; cursor keys edit only in text fields.

Design

All editing routes through one App::active_input_mut seam (search / command / focused form field); a private after_input_edit hook keeps the live search filter re-anchoring on content edits. The slice-3/4 *_push/*_pop methods remain as thin delegations so existing tests are untouched.

Deliberate deviation

Ctrl+C stays the global quit, not §7.2's literal Ctrl+C=copy — there's no selection model and quit-safety/muscle-memory win. Tracked follow-ups: a selection model + Ctrl+C/X/V/Z copy/cut/paste/undo, and reading the agent clipboard back for paste (would be the first secret read back out of the agent).

Tests

TextInput units (insert/delete at cursor, nav clamping, kills return removed text, paste at cursor, UTF-8 boundary safety), kill→yank round-trip, paste-into-focused-field, search-edit re-anchor, and a mid-string caret TestBackend smoke. Workspace: 135 tests green, clippy -D warnings clean, cargo deny clean, both headless builds green.

🤖 Generated with Claude Code

The /search, :command line, and every add/edit form field were
append/backspace-only Strings with no cursor and no paste. Give them a
shared TextInput { buf, cursor } with real line editing (PRD §7.2
Bindings). TUI-only: no protocol, agent, CLI, or dependency changes.

- Cursor movement ←/→/Home/End (+ Ctrl+A/E), Delete at the cursor, and
  insert anywhere — fix a mid-word typo without deleting back to it.
- Kill/yank into a shared kill-ring: Ctrl+W word-back, Ctrl+U to-start,
  Ctrl+K to-end, Ctrl+Y yank.
- Bracketed paste (EnableBracketedPaste + Event::Paste): paste from the
  system clipboard, incl. over SSH/tmux, at the cursor; newlines stripped
  (inputs are single-line).
- Ctrl+S submits the form (PRD §7.2 save). On the form Type row
  ←/→/Space still toggle login⇄note; cursor keys edit only in text
  fields. The caret renders where edits land (gi▌t), not just at the end.
- Ctrl+C stays the global quit — a deliberate deviation from §7.2's
  literal Ctrl+C=copy (no selection model; quit-safety wins). Selection +
  copy/cut/paste/undo and reading the agent clipboard back are tracked
  follow-ups.

All editing routes through one App::active_input_mut seam; a private
after_input_edit hook keeps the live search filter re-anchoring on
content edits. The slice-3/4 *_push/*_pop methods stay as thin
delegations so existing tests are untouched.

Tests: TextInput units (insert/delete at cursor, nav clamping, kills
return removed text, paste at cursor, UTF-8 boundary safety), kill→yank
round-trip, paste-into-focused-field, search-edit re-anchor, and a
mid-string caret TestBackend smoke. 135 workspace tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@UnbreakableMJ
UnbreakableMJ merged commit 658eda0 into main Jun 14, 2026
8 checks passed
@UnbreakableMJ
UnbreakableMJ deleted the tui-text-input branch June 14, 2026 08:50
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.

1 participant