feat(fuzzy): interactive fuzzy-search TUI for password store#41
Merged
Conversation
…eation Split the monolithic fuzzy/mod.rs (~900 lines) into focused modules: - app.rs — App state, AppMode, PendingAction - entries.rs — store walking + tiered fuzzy matcher (exact > substring > subseq) - events.rs — main event loop and per-mode keyboard/mouse handlers - actions.rs — copy/display/qr/edit/regenerate/generate-new/insert-new handlers - ui.rs — ratatui rendering only
- Add double-click on result rows to act as Enter (open action popup) - Anchor display popup near the selected row instead of always centering - Strict key handling in display mode: only Esc/Enter/q/Ctrl-C respond - Fix Ctrl+C in action popup being misread as the 'c' (copy) shortcut - Restore terminal cleanly on exit (clear + leave alt screen, vim-like) - Release mouse capture in display mode for native text selection
On Windows (ConPTY), crossterm reports both Press and Release for every key, while Linux/macOS only report Press. The Enter pressed to launch the binary delivered a Release event into the TUI's event loop right after startup, which our handlers treated as a fresh Enter Press and auto-opened the action popup on the first entry.
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
Add an interactive fuzzy-search TUI that opens when
parsis invoked with no subcommand (replacing the old defaultlsbehavior). The feature is gated byfeature_config.fuzzy_searchand falls back tocmd_lswhen disabled.Highlights
Ctrl-G/Ctrl-N), with overwrite confirmation when an entry already exists.feature_config.vim_mode):Esc/imode toggle,j/k,g/G,dd/Dto clear input,Ctrl-U/D/F/Bhalf/full page nav.cmd_edit,cmd_generate,cmd_insertrun with the alt-screen torn down so vim/nano render correctly; full screen refresh on every mode transition.KeyEventKind::Pressevents at the top of the loop so the Enter that launched the binary doesn't get re-delivered as a release and auto-select the first entry.exit_on_copy(default off),vim_mode(default off),fuzzy_search(default on); env overridesPARS_VIM_MODE,PARS_NO_FUZZY.Failed to execute external command 'name': ....Module layout (
cli/src/fuzzy/)mod.rs— public entry, terminal setup/teardown,AppModeenumapp.rs—Appstate,PendingAction,PopupRecthit-testingentries.rs— store walk + tiered fuzzy filterevents.rs— main event loop and per-mode handlersactions.rs— copy / display / qr / edit / regenerate / generate-new / insert-new + lazy-decrypt + y/N readerui.rs— all ratatui rendering (search bar, list with match highlights, action popup, name-input popup, full-screen display view, confirmation card)Test plan
cargo buildandcargo testcleanparswith an empty store → friendly message, no panicparswith entries → live filter, arrow +j/k+ scroll navigationexit_on_copy│/║, no other entry names)Ctrl-G/Ctrl-N→ name-input popup; overwrite confirmation when entry existsEsc→ Normal,i→ Insert;dd,D,Ctrl-U/D/F/B,g/Gcargo rundoes NOT auto-open the action popup on launchq/Ctrl-Cexit cleanly with no leftover screen artifacts🤖 Generated with Claude Code