-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Feat/search in messages in session #4898
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?
Conversation
- Added a search input component to allow users to search through messages. - Implemented logic to highlight search matches and navigate between them. - Updated the theme syntax rules to include strikethrough styling. - Enhanced message rendering to support search highlighting for text and markdown parts.
- Refactored match navigation logic to prevent scrolling to the same message when navigating through matches. - Enhanced search highlighting to correctly identify and highlight query text within code blocks. - Updated rendering of Assistant messages to include IDs for better scrolling functionality during searches.
…t get it working in Assistant Messages (markdown)
|
Its a bit of string manipulation to get the markdown highlighting working, and also had to make use of the |
Merge upstream PR sst#4898 from OpeOginni: - Add SearchInput component for searching through messages - Implement match navigation with highlighting - Add strikethrough styling in theme syntax rules - Enable Ctrl+F keybind to toggle search mode
Merges upstream PR sst#4791 which adds: - Bash output viewer with full ANSI color support using opentui-ansi-vt - Terminal emulation for accurate color rendering - Page up/down and Home/End navigation in bash output viewer - Click to view full output for truncated bash results - Forces color output in bash commands (FORCE_COLOR=1) - Adds initialValue prop to Prompt component for restoring drafts Preserves our local features: - Token tracking and context percentage display - Search in messages (Ctrl+F) from PR sst#4898
* feat(tui): implement search functionality in session view - Added a search input component to allow users to search through messages. - Implemented logic to highlight search matches and navigate between them. - Updated the theme syntax rules to include strikethrough styling. - Enhanced message rendering to support search highlighting for text and markdown parts. * feat(tui): add bash output viewer with ANSI color support Adds an bash output viewer with full ANSI color support. When bash commands produce more than 20 lines of output, users can click to expand into a full-screen viewer with syntax highlighting and keyboard navigation. Key features: - Full ANSI/VT color rendering using opentui-ansi-vt terminal emulation - Truncated preview (20 lines) with 'Click to view full output' expansion - Prompt text preservation when entering/exiting viewer - Force color output in bash commands (FORCE_COLOR, CLICOLOR, TERM env vars) Technical changes: - Added opentui-ansi-vt dependency for terminal buffer rendering - Added initialValue prop to Prompt component to restore draft text - Strip ANSI codes for search to match actual text content * limit to MAX_OUTPUT_LENGTH * remove ANSI from model output with ptyToText * use 120 rows for terminal output * chore: update opentui-ansi-vt to 1.2.7 * feat(tui): add page up/down support to bash output viewer * fix(tui): improve match navigation and search highlighting - Refactored match navigation logic to prevent scrolling to the same message when navigating through matches. - Enhanced search highlighting to correctly identify and highlight query text within code blocks. - Updated rendering of Assistant messages to include IDs for better scrolling functionality during searches. * chore(tui-search): Removed active match differenciation, since we cant get it working in Assistant Messages (markdown) * feat: implement double Ctrl+C to exit functionality with warning toast * fix: improve token counting for synthetic and noReply messages (PR sst#4709) Cherry-pick fix from upstream PR sst#4709 by arsham: - Use 'ignored' flag instead of 'synthetic' for accurate token counts - Fix sentEstimate formula to prevent double-counting tool result tokens - Add null checks in calculateToolResultTokens for safety - Prevents exponential growth from double-counting in session totals * docs: update README for shuvcode fork - Add header explaining this is a fork for PR integration testing - Include table of merged PRs with upstream status - Preserve original opencode documentation below * changing sidebar version display to shuvcode
|
@ariane-emory yeah that's because they are all in the same message block I'm guessing, since the only unique part of the component we can reference to scroll to is the message in which the word appears in, yeah it's not the best. Best thing to do is to get more ids for parts of text in a complete message block. PS: Happy to see you using it 🙂 |
|
Sorry, I may not be following. What are 'all in the same message block'? While incrementing from 1 to 6, only a single instance of the search term is onscreen. |
|
Ohh really, must have missunderstood then, so it shows 12, but you only see 2? Or you do see more if you scoll down but for example they all are in the same response block from either you or the model? |
|
There are 12 instances present total, but moving to the next search item doesn't necessarily put the item on screen: there are 6 instances of the string Since the viewport remains pointed at the start of this long message, the these instances enter the viewport while incrementing the search's instance index, so I won't actually ever actually see those instances unless I manually scroll within the message. This isn't the behaviour users generally expect from a search function. |
|
Yes I understand now, it goes with what I was saying in the other message
For now each match is connected to a message block, so we dont update the viewport until its a different message, I could tinker a bit more to find a solution. |
|
@OpeOginni Your explanation for why it behaves this way does make sense, but it nonetheless does seem to violate the expectations users are likely to have: when a user selects item Eager to see what solution you come up with, I'd love to have a search tool with the same usual, conventional behaviour as most other applications' search tools. |
|
I see there is a need for it, ill surely get it done! |
|
@ariane-emory Made an update, mostly using estimation based on the index of the word, to predict its position and determine if it is in view or not. Did some tests to the best way I can, its getting about 80% scrolls right. Try it out and tell me how it goes? |
|
@OpeOginni Sure, will do - it's already late, so I might not get to try it out tonight, but if I don't I'll certainly try it out tomorrow. |
This merge brings upstream changes while preserving fork-specific features: Preserved fork features: - PR sst#4898: Search in messages (Ctrl+F) - PR sst#4791: Bash output with ANSI colors - PR sst#4900: Double Ctrl+C to exit - PR sst#4709: Live token usage during streaming - PR sst#4865: Subagents sidebar with clickable navigation - PR sst#4515: Show plugins in /status - Fork-only: Toggle session header visibility Resolved conflicts: - Package versions updated to upstream v1.0.149 - Keybind type changes (cmd -> super) - Desktop context files updated with defensive API checks - UI components updated for new items prop signature - input.css/tsx renamed to text-field.css/tsx Validation: - All typechecks pass (12/12 packages) - All tests pass (281 passed, 1 skipped) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Resolved conflicts: - bun.lock: Regenerated from scratch - packages/*/package.json: Accept upstream version (1.0.167) - packages/extensions/zed/extension.toml: Accept upstream version Upstream changes include: - Version bump to 1.0.167 - Terminal title toggle feature added to config - MCP authentication improvements - Legal pages (privacy policy, terms of service) - Tauri package updates Fork features preserved: - PR sst#4898: Search in messages (Ctrl+F) - PR sst#4791: ANSI bash output support - PR sst#4900: Double Ctrl+C to exit - PR sst#4709: Live token usage during streaming - PR sst#4865: Subagents sidebar navigation - PR sst#4515: Show plugins in /status - PR sst#5508: Cache management commands - PR #ariane-emory: Granular file permissions - PR #fork-140: Toggle transparent background - Desktop features: slash commands, shell mode, themes, branding
Resolved conflicts: - script/publish.ts: kept fork version (fork-specific publishing to Latitudes-Dev/shuvcode) Auto-merged files with upstream improvements: - packages/opencode/src/cli/cmd/tui/routes/session/index.tsx: new dialog-subagent component - packages/opencode/src/session/message-v2.ts: improved error handling - packages/desktop/src/context/global-sync.tsx: added null directory guards Preserved fork features: - PR sst#4898: Search in messages (Ctrl+F) - PR sst#4791: Bash output with ANSI - PR sst#4900: Double Ctrl+C to exit - PR sst#4709: Live token usage during streaming - PR sst#4865: Subagents sidebar with clickable navigation - PR sst#5508: Cache management command - Glob permissions feature - Toggle transparent background - Desktop slash commands and share functionality
Resolved conflicts: - packages/opencode/src/cli/cmd/tui/routes/session/index.tsx: Merged fork search highlighting with upstream user message markdown toggle - packages/opencode/package.json: Accept upstream v1.0.170, preserved ghostty-opentui dependency - .github/workflows/generate.yml: Keep fork-specific workflow (better error messaging) - script/publish.ts: Keep fork-specific publish script (shuvcode registry, contributors) - packages/extensions/zed/extension.toml: Accept upstream v1.0.170 - All other package.json files: Accept upstream v1.0.170 versions - bun.lock: Regenerated Preserved fork features: - PR sst#4898: Search in messages (Ctrl+F with highlighting) - PR sst#4791: Bash output with ANSI (ghostty-opentui) - PR sst#4900: Double Ctrl+C to exit - PR sst#4709: Live token usage during streaming - PR sst#4865: Subagents sidebar with clickable navigation - PR #fork-140: Toggle transparent background - Fork: Toggle session header visibility - Fork: Desktop slash commands and shell input mode - Fork: Desktop Night Owl theme - Fork: Desktop theme/font pickers and branding - Fork: Share functionality for shuv.ai - Fork: Desktop mobile responsiveness - Fork: Desktop review pane resizing New upstream feature integrated: - User message markdown toggle (enable/disable markdown rendering in user messages)



Feature corresponding to #4714
Enables searching for text using the keybind
ctrl + f, changes prompt input to a search input that then highlights any matches in the session.Users can return back to the prompt bar by clicking
escUsers can navigate matches using the up and down key.
Idea and flow was my idea, but did use AI for some of the implementation, also for searching codebase where other functions were used such as scrolling programmatically.
further-reduced.mov