opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(tui): add ctrl+r history search

Open jiahaoxiang2000 opened this issue 3 weeks ago • 1 comments

Summary

Implements Ctrl+R history search functionality for the TUI prompt, allowing users to fuzzy search through their prompt history.

Image

Changes

  • Added DialogHistorySearch component with fuzzy filtering and deduplication
  • Increased max history entries from 50 to 100
  • Added items getter and reset() method to PromptHistory context
  • Added history_search keybind (default: ctrl+r) to config
  • Integrated history search into prompt component

Closes https://github.com/sst/opencode/issues/5062 Related #6276

jiahaoxiang2000 avatar Dec 19 '25 02:12 jiahaoxiang2000

Hey @jiahaoxiang2000! I implemented an alternative approach in #6276 that uses inline reverse-i-search (bash-style) instead of a modal dialog.

Key differences:

  • Matches display directly in the prompt textarea rather than a separate dialog
  • Follows the exact bash/zsh/fish convention: (reverse-i-search)'query': N/M
  • Reuses existing prompt rendering for parts/extmarks instead of creating a separate list view

This was inspired by @ShpetimA's suggestion in #5062:

Maybe just simple search style like bash where you search and it shows on the input instantly instead of opening history modal.

Both approaches have merit - the modal provides a visual list which some users might prefer, while inline keeps the shell-like feel. Curious what the maintainers think about which direction fits better for opencode's TUI!

edlsh avatar Dec 28 '25 04:12 edlsh