Skip to content

feat: search earlier prompts with Ctrl+R - #794

Open
hakula139 wants to merge 4 commits into
mainfrom
feat/prompt-history
Open

hakula139 wants to merge 4 commits into
mainfrom
feat/prompt-history

Conversation

@hakula139

@hakula139 hakula139 commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Ctrl+R searches earlier prompts and puts a selection into the draft without sending it. The picker starts in the current project, Ctrl+S searches every project, and Esc or Ctrl+C preserves the complete editor state.

  • History: query retained ordinary user text in the existing session store, including archived sessions and rows retained by rewind or compaction. Fork and import copies appear once per message ID, while separate submissions of identical text remain separate entries. Filtering matches literal substrings without case sensitivity across the full prompt.
  • Picker: show ages, first lines, project labels and a scrollable escaped multiline preview. Session and prompt pickers share typed page workers. Searches examine bounded batches and keep one worker in flight while query and scope changes retain only the latest requested search.
  • Editing: Enter recalls full text through the input's existing replacement behavior, with slash completions refreshed. Alt+R redoes edits in the input and modal fields. A nonempty draft replacement takes two native Ctrl+Z steps to undo.
  • Storage: revision 2 adds a partial index for original message-time pagination, preserving the content format and compatibility with older readers. Initial and continuation query plans use the index without a temporary sort.

Closes #421

Test plan

  • Store regressions cover exact ordinary text, generated origins and tool results, retained and deleted rows, supported formats, scope, original-time ordering, logical deduplication, literal Unicode filtering and empty nonfinal pages. A real revision-1 database migrates without losing its row.

  • Picker and app regressions cover stale results, rapid query and scope changes, empty-page continuation, draft selection, yank and undo preservation during a running turn, native redo, slash completions, modified Enter, short layouts and preview lines beyond 65,535. Nine snapshots cover the visible states. Explicit loading, completion and failure states preserve failed queries and partial results without claiming exhaustion.

  • Focused mutations confirm the origin filter, scope, deduplication predicate, schema index, request identity and render boundaries are guarded.

  • Isolated keyboard smoke at the final review-fix head covered Ctrl+R, scope and filtering, preview scrolling, Enter without submission, Esc, native undo, Alt+R and normal exit. Confirmed zero local mock requests and only the two invented fixture messages remaining stored. A synthetic page-load error preserved the query, suppressed false completion notes and recovered through a scope change.

  • Final review-fix head verification: formatting, build, both Clippy commands, rustdoc, coverage, unreferenced snapshot rejection and the three pnpm checks. All 3,511 tests passed, with five paid live tests ignored. Changed executable line coverage is 99.65% (1,131 / 1,135).

  • All nine CI checks passed on the final head, including Linux / macOS Nix, Linux / macOS / Windows Rust, lint, MSRV, the aggregate result and Codecov patch. Independent code and usability reviews have no remaining findings.

Manual Windows and real-model behavior were not tested.

@hakula139 hakula139 added enhancement A new user-facing capability or an extension of one (feat) area: session Touches session storage, listing, or resume area: tui Touches terminal UI rendering, input, or theming labels Oct 30, 2026
@hakula139 hakula139 self-assigned this Oct 30, 2026
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.65217% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/ox-tui/src/modal/pages.rs 98.19% 2 Missing ⚠️
crates/ox-core/src/session/store/prompt_history.rs 99.61% 1 Missing ⚠️
crates/ox-tui/src/prompt_history.rs 99.79% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@hakula139 hakula139 mentioned this pull request Oct 30, 2026
5 tasks done
Query retained user messages with bounded indexed pages and copy selections into the draft. Reuse typed page workers with the resume picker so query and scope changes keep one worker in flight.

Preserve native editor undo and move redo to Alt+R. Add store, picker, draft preservation and layout regressions, plus usage documentation.
Represent list loading, completion and failure explicitly so a failed
search preserves its query and partial rows without claiming no matches.
Apply the state contract to both prompt and resume pickers, keeping
navigation from clearing a failure and reload from retaining it.

Cover scope recovery, navigation, foreign page routing and Ctrl+R hints.
Focused deliberate regressions fail before restoring the source, and the
restored TUI suite passes all 1,493 tests.
@hakula139
hakula139 force-pushed the feat/prompt-history branch from 1aa1c06 to 69f435c Compare November 1, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: session Touches session storage, listing, or resume area: tui Touches terminal UI rendering, input, or theming enhancement A new user-facing capability or an extension of one (feat)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search earlier prompts with Ctrl+R

1 participant