Repository navigation
feat(web): terminal citation previews render with the terminal's own renderer - #360
Merged
Merged
Conversation
…renderer The hover preview re-laid captured output as HTML text, which rewrapped wide lines to the card's width and broke powerline prompts apart. It now mounts a read-only Ghostty surface sized to the excerpt, so lines keep their captured width and scroll sideways, and selection, copy, and scrolling are the terminal drawer's own. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The preview's terminal swallowed app shortcuts, could trigger a clipboard permission prompt on paste, showed an empty box if the renderer failed to load, had no right-click Copy or touch selection, stranded focus when the card closed, and closed mid-selection when a drag ended outside it. The surface gains a readOnly mode: only copy, select-all, and scrollback keys are handled, nothing is pasted, and a touch long press selects a word. The card shows plain text until the renderer is ready (or if it fails), starts loading on hover intent, offers Copy and Select all on right-click and a Copy button in its header, stays open once pressed inside, and hands focus back to the composer when it closes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… it sideways The terminal autoscrolls a selection drag vertically through its scrollback, but the preview's sideways scroller sat still, so a drag past the card's left or right edge selected columns out of view. The card now scrolls while the pointer is past an edge and extends the selection through the surface's new extendSelectionDrag. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…place A read-only surface opted out of key handling part-way down the handler, so a key branch added above that point for the drawer would have reached previews too. Read-only is now an allowlist checked first (selection, copy, and scrollback keys), and every byte bound for the PTY, including the terminal's own replies, passes one sendInput that drops it for a viewer. The read-only test now covers keys, paste, input, composition, middle click, wheel on the alternate screen, status replies, and focus on creation. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Hovering a terminal citation re-laid the excerpt out as HTML text, so anything wider than the card was rewrapped: powerline prompts split into ragged boxes, words broke mid-token, and continuation lines lost their alignment. The preview now uses the terminal's own renderer, read-only, so it looks and selects exactly like the terminal drawer.
What changes for users
How
GhosttyTerminalSurfacewith a newreadOnlyoption, sized to the excerpt withsizeToGrid(columns from the widest line, wide characters counted as two cells, capped at 400). It's created when the card opens and disposed when it closes.readOnlyis enforced in one place each: an allowlist at the top of the key handler, so key handling added later for the drawer skips viewers by default, and a singlesendInputthat every PTY-bound byte passes, including the terminal's own replies.ContextChipPopovergainsonIntent(preload) andstayOpenAfterPress(pin plus focus hand-back).terminalStyledText.ts) is removed; its remaining helper moves intoterminalContext.ts.Mobile has no hover preview, so it's unaffected. Old excerpts without styled text render as plain text through the same surface.
Known, not changed here: after clicking inside any chip hover card (also on
main), clicking another control such as the sidebar search moves focus to the chip button. That's Base UI focus handling shared by everyContextChipPopover, so it belongs in its own fix.Screenshots
日本語 wide 🎉 ok)Testing
terminalContext.test.ts,ghostty/core.test.ts, andghostty/surface.test.ts. New tests cover the read-only mode (keys, paste, input, composition, middle click, alternate-screen wheel, status replies, focus on creation), touch long press, drag extension, and that a styled selection replays into a fresh terminal with identical cells.tscand lint are clean on the changed files.copycommand Electron's menu role usesBuilt with Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code