-
Notifications
You must be signed in to change notification settings - Fork 3.8k
feat(tui): add ctrl+r history search #5775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
feat(tui): add ctrl+r history search #5775
Conversation
6464265 to
fe7be3f
Compare
- Replace simple select dialog with advanced fuzzy search interface - Add fuzzysort integration for intelligent text matching - Implement keyboard navigation (arrows, page up/down, vi keys) - Add real-time filtering with match highlighting preview - Improve visual design with selection highlighting and theming - Add mouse support for item selection and hover navigation - Add Ctrl+U keyboard shortcut to clear search filter
Implements bash-style inline history search as suggested in sst#5062. Alternative approach to sst#5775's modal dialog. Features: - Inline reverse-i-search: preview matches directly in prompt textarea - Incremental substring search with real-time updates - Keyboard controls: Ctrl+R/Up cycle older, Down for newer, Enter accept, Esc/Ctrl+G cancel - Status line showing (reverse-i-search)'query': N/M - Full state preservation: prompt text, parts, extmarks, mode, cursor position - Configurable keybind (history_search, default: ctrl+r) Implementation details: - historySearch state tracks: active, query, matchIndex, originalPrompt, originalMode, originalCursorOffset - Exposed history.items getter for direct access to prompt history - History search takes precedence over shell-mode and other handlers when active - Paste blocked during search mode - Preview updates parts/extmarks consistently with normal history navigation Closes sst#5062 Related to sst#1701
|
Hey @jiahaoxiang2000! I implemented an alternative approach in #6276 that uses inline reverse-i-search (bash-style) instead of a modal dialog. Key differences:
This was inspired by @ShpetimA's suggestion in #5062:
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! |
Implements bash-style inline history search as suggested in sst#5062. Alternative approach to sst#5775's modal dialog. Features: - Inline reverse-i-search: preview matches directly in prompt textarea - Incremental substring search with real-time updates - Keyboard controls: Ctrl+R/Up cycle older, Down for newer, Enter accept, Esc/Ctrl+G cancel - Status line showing (reverse-i-search)'query': N/M - Full state preservation: prompt text, parts, extmarks, mode, cursor position - Configurable keybind (history_search, default: ctrl+r) Implementation details: - historySearch state tracks: active, query, matchIndex, originalPrompt, originalMode, originalCursorOffset - Exposed history.items getter for direct access to prompt history - History search takes precedence over shell-mode and other handlers when active - Paste blocked during search mode - Preview updates parts/extmarks consistently with normal history navigation Closes sst#5062 Related to sst#1701
Implements bash-style inline history search as suggested in sst#5062. Alternative approach to sst#5775's modal dialog. Features: - Inline reverse-i-search: preview matches directly in prompt textarea - Incremental substring search with real-time updates - Keyboard controls: Ctrl+R/Up cycle older, Down for newer, Enter accept, Esc/Ctrl+G cancel - Status line showing (reverse-i-search)'query': N/M - Full state preservation: prompt text, parts, extmarks, mode, cursor position - Configurable keybind (history_search, default: ctrl+r) Implementation details: - historySearch state tracks: active, query, matchIndex, originalPrompt, originalMode, originalCursorOffset - Exposed history.items getter for direct access to prompt history - History search takes precedence over shell-mode and other handlers when active - Paste blocked during search mode - Preview updates parts/extmarks consistently with normal history navigation Closes sst#5062 Related to sst#1701
Implements bash-style inline history search as suggested in sst#5062. Alternative approach to sst#5775's modal dialog. Features: - Inline reverse-i-search: preview matches directly in prompt textarea - Incremental substring search with real-time updates - Keyboard controls: Ctrl+R/Up cycle older, Down for newer, Enter accept, Esc/Ctrl+G cancel - Status line showing (reverse-i-search)'query': N/M - Full state preservation: prompt text, parts, extmarks, mode, cursor position - Configurable keybind (history_search, default: ctrl+r) Implementation details: - historySearch state tracks: active, query, matchIndex, originalPrompt, originalMode, originalCursorOffset - Exposed history.items getter for direct access to prompt history - History search takes precedence over shell-mode and other handlers when active - Paste blocked during search mode - Preview updates parts/extmarks consistently with normal history navigation Closes sst#5062 Related to sst#1701
Summary
Implements Ctrl+R history search functionality for the TUI prompt, allowing users to fuzzy search through their prompt history.
Changes
DialogHistorySearchcomponent with fuzzy filtering and deduplicationitemsgetter andreset()method toPromptHistorycontexthistory_searchkeybind (default:ctrl+r) to configCloses #5062
Related #6276