Repository navigation
Conversation
/preview opens a fuzzy file picker and renders the selected file as rendered markdown in a side panel next to the session: inline split on wide terminals, right-docked overlay on narrow ones, matching the sidebar layout pattern. Token-/command-configurable keybinds preview_toggle and preview_close default to unbound.
The inline vs overlay dual-mode layout and the contentWidth accounting look correct, including the wide() transition path. — AI code review (automated) |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #43598
Type of change
What does this PR do?
Adds
/previewto the session view. It opens the fuzzy file picker (samefs.findsearch as@-mentions) and renders the selected file as markdown in a panel to the right of the session: an inline split pane on wide terminals and a right-docked overlay on narrow ones, mirroring the sidebar layout. Running/previewagain closes it. New keybind tokenspreview_toggle/preview_closedefault to unbound.The panel reuses the built-in
<markdown>renderable withstreaming={false}, so content renders exactly like assistant messages (headings, code blocks, grid tables). Related web/desktop request: #38047 — TUI has no file preview today.How did you verify your code works?
bun testinpackages/tui: addstest/cli/tui/markdown-preview.test.tsx(rendered file content + unreadable-file state). Full suite: 194 pass; the 1 failure (runtime.test.tsxexpects~/projectbut gets~\project) is a pre-existing Windows path-separator issue that also fails on an unmodified checkout.packages/tuitypecheck passes (tsgo --noEmit). oxlint + prettier clean on touched files.testRendermount: frame below.Screenshots / recordings
Headless testRender capture (side-by-side, dark theme):
``
鈼?session "shipping rules analysis" CHANGELOG.md
user: # Changelog
what shipped to Shanghai last week? ## 1.2.0
assistant: - add
/previewpanel for rendered markdown- sidebar-respecting split layout
Found 1,284 orders across 3 hubs. Details in the table on the right 鈥?
SELECT city, count(*) AS cnt
鈻峚sk anything鈥? FROM orders
GROUP BY 1 ORDER BY 2 DESC;
``
Checklist