Files
tty7/openwiki
7401fd59df feat(history): Ctrl+R fuzzy search menu with run metadata (#45)
* feat(history): Ctrl+R fuzzy search menu with run metadata

Ctrl+R grows from the single-line reverse-i-search into a browsable
menu of ranked candidates floating beside the prompt:

- Matching is fuzzy (src/terminal/fuzzy.rs, a dependency-free
  affine-gap aligner: word-boundary and consecutive-run bonuses, gap
  penalties; space-separated query terms must all match), blended with
  the existing frecency scores so a command you run constantly — or
  ran in this directory — outranks an equally-good textual match.
- An empty query lists the whole history by frecency, so bare Ctrl+R
  is a "recent & relevant" browser. Matched characters highlight in
  the rows; Ctrl+R/Down and Ctrl+S/Up move the selection, Enter loads
  the line into the editor, Cmd+Enter runs it outright. The classic
  (reverse-i-search) prompt line stays.
- History records now carry run metadata: new lines are
  <ts>\t<exit>\t<cwd>\t<command>, written when the command finishes
  (zsh INC_APPEND_HISTORY_TIME-style) so the exit code sniffed from
  OSC 133;D lands in the record; older formats still parse, and
  zsh/bash HISTFILE timestamps carry over when seeding. The menu shows
  "ran 3h ago" and a red x-badge on commands whose last run failed.
- RemoteTerminal exposes prompt_seq/last_exit_code so the view can
  tell a fresh post-command prompt report from the stale pre-submit
  state even when 1 Hz polling misses a fast command's running window.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* style: cargo fmt

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 18:28:42 +08:00
..