feat(vault-tui): readline text-input editing + bracketed paste#9
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The TUI's
/search,:command line, and every add/edit form field were append/backspace-onlyStrings — no cursor, no paste. They now share aTextInput { 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
←/→/Home/End(+Ctrl+A/Ctrl+E),Deleteat 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.Ctrl+W(word back),Ctrl+U(to start),Ctrl+K(to end),Ctrl+Y(yank).EnableBracketedPaste+Event::Paste): paste from the system clipboard — including over SSH/tmux — at the cursor; newlines stripped (every input is single-line).Ctrl+Ssubmits the add/edit form (PRD §7.2 save). On the form's Type row←/→/Spacestill toggle login⇄note; cursor keys edit only in text fields.Design
All editing routes through one
App::active_input_mutseam (search / command / focused form field); a privateafter_input_edithook keeps the live search filter re-anchoring on content edits. The slice-3/4*_push/*_popmethods remain as thin delegations so existing tests are untouched.Deliberate deviation
Ctrl+Cstays the global quit, not §7.2's literalCtrl+C=copy — there's no selection model and quit-safety/muscle-memory win. Tracked follow-ups: a selection model +Ctrl+C/X/V/Zcopy/cut/paste/undo, and reading the agent clipboard back for paste (would be the first secret read back out of the agent).Tests
TextInputunits (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 caretTestBackendsmoke. Workspace: 135 tests green,clippy -D warningsclean,cargo denyclean, both headless builds green.🤖 Generated with Claude Code