Skip to content

feat(tui): add read-only file preview dialog - #46665

Closed
xxxiaocat wants to merge 1 commit into
anomalyco:devfrom
xxxiaocat:tui-md-preview
Closed

xxxiaocat wants to merge 1 commit into
anomalyco:devfrom
xxxiaocat:tui-md-preview

Conversation

@xxxiaocat

@xxxiaocat xxxiaocat commented Sep 1, 2026 •

Copy link
Copy Markdown

Issue for this PR

Refs #43598 — this is a draft prototype for the design discussion; will switch to Closes if the direction is approved.

Type of change

  • New feature

What does this PR do?

Adds a read-only file preview to the TUI, as proposed in #43598:

  • /preview opens a file picker backed by the same server-side search the @ mention uses
  • .md files render as markdown, other text files show with syntax highlighting, binary files show a notice
  • esc closes; j/k/up/down/pgup/pgdn/g/G scroll
  • Files over 512KB show a "too large" notice instead of being loaded into the render loop

Design choices: reuses /find/file + DialogSelect so ranking matches @ mentions (no client-side search logic), reads content via the existing /file/content endpoint (it already classifies text vs binary), and renders with opentui's built-in <markdown> element — zero new dependencies.

Note: #43599 is another draft prototype for the same issue. Neither has received maintainer direction yet — happy to coordinate, or close this one if the core team prefers that approach.

How did you verify your code works?

  • 6 render-level tests in packages/tui/test/cli/tui/dialog-preview.test.tsx (markdown, code, binary, oversized, error, and a picker end-to-end flow). bun test in packages/tui: 199 pass, 0 fail.
  • bun typecheck passes for all packages, oxlint clean on touched files.

Screenshots / recordings

https://gist.github.com/xxxiaocat/095d822983c36b1bf9d702b137ffbc43 (asciinema cast: /preview → filter readme → select → markdown preview → scroll → esc)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found

PR #43599: feat(tui): markdown preview panel
#43599

Why it's related:

Recommendation: Review PR #43599 to understand if it already implements similar functionality or if these PRs should be coordinated.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Sep 1, 2026
@github-actions github-actions Bot closed this Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant