Skip to content

[v0.3] Add incremental search #29

Description

@owainlewis

Goal: Add Emacs-shaped incremental search for fast navigation inside the current buffer.

Context: Markdown-heavy work needs quick search before Cortex feels usable for real notes and docs.
The PRD reserves C-s for forward isearch and C-r for reverse isearch.
This should build on the minibuffer foundation if that has landed.

Proposed approach:

  • Add search state that owns query text, direction, active match, and original point.
  • Bind C-s to start forward search and repeat forward while search is active.
  • Bind C-r to start reverse search and repeat backward while search is active.
  • Update the active match as the query changes.
  • Render the search prompt and a visible active match with restrained styling.
  • Escape cancels and restores the original point.
  • Enter accepts the current match and exits search.

Acceptance criteria:

  • C-s starts forward incremental search.
  • Typing updates the query without editing the buffer.
  • Matching moves point to the current match as the query changes.
  • Repeating C-s moves to the next match.
  • C-r searches backward or repeats backward while search is active.
  • Escape cancels search and restores the original point.
  • Enter accepts the current match.
  • No-match state is visible and does not move point unexpectedly.
  • Existing editing, save, quit, command line/minibuffer, picker, and highlighting behavior still works.

Verification:

  • Run cargo test.
  • Manually search forward and backward in a Markdown file.
  • Manually test no-match, cancel, accept, repeated search, save, and terminal cleanup.

Out of scope:

  • Regex search.
  • Replace.
  • Project-wide search.
  • Search history.
  • Multi-buffer search.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions