Skip to content

feat: in-session search history recall#171

Merged
umputun merged 8 commits intomasterfrom
search-history
May 8, 2026
Merged

feat: in-session search history recall#171
umputun merged 8 commits intomasterfrom
search-history

Conversation

@umputun
Copy link
Copy Markdown
Owner

@umputun umputun commented May 8, 2026

Up / Ctrl+P recalls the previous submitted query inside the search prompt; Down / Ctrl+N walks forward and clears past the newest entry. History is in-memory, scoped to the session, capped at 50 entries with consecutive-duplicate dedup. README, site/docs.html, both plugin usage.md copies, and the in-app help overlay all list the new keys.

Fixes #170.

umputun added 8 commits May 7, 2026 22:33
Up/Ctrl+P walks backward through past search queries, Down/Ctrl+N walks
forward. Down past the newest entry clears the input. History is
in-memory only with a 50-entry cap and consecutive-duplicate dedup.
Validates Task 2 acceptance gates from the search-history plan.
Modernizes recallHistory clamp logic to use min/max builtins and
range-over-int loop in the cap-enforcement test.
Add Up/Ctrl+P and Down/Ctrl+N rows to the search keybindings tables in
README.md, site/docs.html, and the two byte-identical usage.md copies in
.claude-plugin/ and plugins/codex/. Move the search-history plan file to
docs/plans/completed/.
Refactor appendSearchHistory to a single exit path so the historyIdx
reset isn't duplicated across the dedup early return and the append
path. Trim two test assertion messages that exceeded the 130-char
guideline. Replace the deprecated reflect.Ptr alias with reflect.Pointer
in isNilValue.
inject Up/Ctrl+P and Down/Ctrl+N entries into the existing Search
section of the help overlay so users can discover the in-prompt
recall keybindings without reading the README.
replace 9 backward for-loops with slices.Backward iterators across
app/themes.go, app/ui/annotate.go, app/ui/diffnav.go, app/ui/view.go,
and app/ui/sidepane/filetree.go. clears modernize linter findings.
no behavior change.
Copilot AI review requested due to automatic review settings May 8, 2026 03:42
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds in-session (non-persisted) search query history recall within the / search prompt, addressing issue #170 by allowing users to navigate previously submitted queries via Up/Ctrl+P and Down/Ctrl+N.

Changes:

  • Implemented session-scoped search query history in the TUI search prompt (deduped, capped at 50, with recall navigation).
  • Added unit tests covering history append/dedup/cap behavior, recall navigation, and help-overlay entry presence.
  • Updated user-facing documentation/help to list the new keybindings; additionally refactored several reverse-iteration loops to use slices.Backward.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
app/ui/search.go Adds capped in-memory search history, recall navigation, and key handling for Up/Down + Ctrl+P/Ctrl+N.
app/ui/model.go Extends searchState with history fields; adjusts typed-nil detection logic.
app/ui/search_test.go Adds comprehensive unit tests for search history behavior and key wiring.
app/ui/handlers.go Extends help overlay “Search” section with the new recall keybindings.
app/ui/handlers_test.go Tests that help overlay includes the new search prompt history entries.
README.md Documents the new search prompt recall keybindings.
site/docs.html Documents the new search prompt recall keybindings for the website docs.
.claude-plugin/skills/revdiff/references/usage.md Updates plugin usage docs with the new search recall keybindings.
plugins/codex/skills/revdiff/references/usage.md Updates plugin usage docs with the new search recall keybindings.
docs/ARCHITECTURE.md Updates architecture documentation to include the new searchState fields.
docs/plans/completed/20260507-search-history.md Adds completed implementation plan/notes for the feature.
app/ui/view.go Refactors reverse traversal in truncation helper using slices.Backward.
app/ui/sidepane/filetree.go Refactors multiple reverse loops (truncation, navigation) using slices.Backward.
app/ui/diffnav.go Refactors reverse loop(s) for cursor/hunk navigation using slices.Backward.
app/ui/annotate.go Refactors reverse scan in visualRowToDiffLine using slices.Backward.
app/themes.go Refactors reverse deletion loop using slices.Backward.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/ui/model.go
@umputun umputun merged commit f297c68 into master May 8, 2026
9 checks passed
umputun added a commit that referenced this pull request May 8, 2026
Documents the search-history keybindings (Up/Ctrl+P, Down/Ctrl+N) added
to usage.md by #171.
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.

Search history is missing

2 participants