Repository navigation
Conversation
Add mod+f in-page search for the session transcript. Matches are computed from row data (user/assistant text, reasoning, tool inputs, errors) so the virtualized timeline can scroll off-screen matches into view, then rendered hits are highlighted with the CSS Custom Highlight API. Enter / shift+Enter and mod+g / mod+shift+g cycle matches, Escape closes. The pierre file-find host registry is exported so the timeline joins the existing mod+f routing and only one find bar is active at a time. Bottom follow is paused synchronously before navigating so anchor-bottom resize handlers cannot race the find scroll.
V2 sessions carry the prompt on the session message rather than only in projected parts, so user rows could miss matches. Include the projected user/shell message text for user rows alongside part text.
Find shortcuts now follow the platform convention (Cmd on macOS, Ctrl elsewhere) in both the timeline handler and the shared find-host registry, so plain Ctrl+F / Ctrl+G keep their native emacs-style behavior on macOS instead of opening the find bar.
hunterchristian
added a commit
to chipp-ai/opencode
that referenced
this pull request
Sep 23, 2026
Search within the current session's message history -- open with <leader>f or /find (alias /search), type a query, step between matches with Enter/Shift+Enter, Esc to close. Ported from upstream anomalyco#4714 (67 reactions/35 comments). Unusually, the relevant PRs (anomalyco#45037, anomalyco#48470) were still open and unreviewed rather than bot-closed -- but neither actually targets the TUI: both add Cmd/Ctrl+F search to the web/desktop timeline instead. anomalyco#45037's approach (reusing the file viewer's search by scanning the rendered page) can't carry over to a terminal UI. anomalyco#48470's approach -- find matches directly from message data (text, reasoning, tool inputs, error rows), then scroll to the hit -- doesn't depend on a browser, so its matching logic (partSearchText, findMatches) is ported directly into a new packages/tui/src/util/session-find.ts. Its browser-only parts (DOM highlighting, the web find-bar, file-viewer shortcut sharing) have no TUI equivalent and were rewritten as a real terminal find-bar component plus new match-navigation and scroll-target logic. Four new overridable keybinds (session_find <leader>f, session_find_next/previous/close). Matched parts get a highlighted background, stronger on the current match; a collapsed "Thought" block auto-opens while it holds the current match. Known gaps: word-level highlighting only works in user messages (assistant/reasoning/tool rows highlight as a whole block -- the terminal renderer can't highlight part of a markdown block); tool output isn't searched, only tool inputs, matching anomalyco#48470's own choice; a match inside a hidden/collapsed region is counted but has nothing on screen to jump to; only the current session is searched, no cross-session search; keybinds docs and generated SDK types don't list the new keys yet. New packages/tui/test/util/session-find.test.ts (11 tests, adapted from anomalyco#48470's own test file) and packages/tui/test/cli/tui/ session-find.test.tsx (2 tests rendering the real find bar). Verified against this fork's current dev, including the expandable-pasted- text-placeholders feature which touches two of the same files with no conflict: bun typecheck clean; full packages/tui suite 228 pass. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Member
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
N/A - small UX gap: the session transcript has no in-page search. (Resubmission of #48088, which was auto-closed for a template issue; this version also fixes two things found after the first submission.)
Type of change
What does this PR do?
Adds
mod+fin-page search to the session timeline (app and desktop UI).The timeline is virtualized, so matches are computed from row data (user/assistant text, reasoning, tool call inputs, error rows, plus the projected message text that V2 sessions carry on the message itself) instead of the DOM. The active match scrolls into view through the virtualizer, and rendered hits are highlighted with the CSS Custom Highlight API under the same
opencode-findnames and colors the pierre file viewer already uses. Highlights rebuild as rows mount and unmount while scrolling.The timeline registers as a find host in the existing pierre
file-findregistry (newregisterFindHost/activateFindHostexports), somod+f/mod+grouting is shared with the file viewer and only one find bar is active at a time; file tabs keep their existing behavior and win viadefaultPrevented. The bar is the existingFileSearchBarcomponent with the existingui.fileSearch.*i18n keys, so no new strings. Shortcuts follow the platform convention (Cmd on macOS, Ctrl elsewhere) so plain Ctrl+F keeps its native cursor-forward behavior.One non-obvious fix: bottom-follow is paused synchronously (new
onPauseScrollprop wired toautoScroll.pause) before navigating to a match, otherwise anchor-bottom resize handlers race the find scroll and pull the viewport back down.How did you verify your code works?
find.test.tscovers search-text extraction and match computation. Full app unit suite passes except one pre-existing i18n failure that also fails ondev.bun dev+ a local server with seeded sessions:mod+fopens the bar even while the composer is focused; counts shown/m,0/0on no match.Enter/shift+Entercycle with wrap-around;mod+g/mod+shift+gnavigate while open.Escapecloses the bar and clears all highlights.Screenshots / recordings
Happy to attach a recording on request; verified interactively as described above.
Checklist