Skip to content

transcript: stop the newest lines of a reply being cut off - #15

Merged
tdwd merged 1 commit into
mainfrom
fix-transcript-cutoff
Oct 15, 2026
Merged

tdwd merged 1 commit into
mainfrom
fix-transcript-cutoff

Conversation

@tdwd

@tdwd tdwd commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Three things hid the end of the transcript.

Glamour wraps prose but never breaks a token, so a long path, URL, inline
code span or code line reached the viewport wider than it. The viewport's
View wraps such a line again and then cuts to its height, so every extra
row pushed one of the newest rows off the bottom, and scrolling could not
bring it back. fitWidth now breaks every rendered entry to the viewport
width. Tabs are expanded first, because ansi.StringWidth and glamour count
a tab as no cells while lipgloss draws four. A link split by a break stays
a link on each line, and a colour cut by a break is closed.

A viewport that got shorter (a taller prompt, the compact bar) kept its
offset, so the rows it lost were the newest ones. resizeViewport now
re-pins to the bottom while following.

Tool output arrives as the program wrote it to a terminal, so cursor-up,
erase-line and \r reached the frame and overwrote rows already drawn.
termSafe keeps text, newlines, tabs and SGR colour and drops everything
else. Only ESC starts a sequence, as in a UTF-8 terminal, so combining
marks survive and a cut-off rune becomes U+FFFD instead of swallowing the
text after it.

Every entry now goes through displayEntry, the one owner of that pipeline.

Three things hid the end of the transcript.

Glamour wraps prose but never breaks a token, so a long path, URL, inline
code span or code line reached the viewport wider than it. The viewport's
View wraps such a line again and then cuts to its height, so every extra
row pushed one of the newest rows off the bottom, and scrolling could not
bring it back. fitWidth now breaks every rendered entry to the viewport
width. Tabs are expanded first, because ansi.StringWidth and glamour count
a tab as no cells while lipgloss draws four. A link split by a break stays
a link on each line, and a colour cut by a break is closed.

A viewport that got shorter (a taller prompt, the compact bar) kept its
offset, so the rows it lost were the newest ones. resizeViewport now
re-pins to the bottom while following.

Tool output arrives as the program wrote it to a terminal, so cursor-up,
erase-line and \r reached the frame and overwrote rows already drawn.
termSafe keeps text, newlines, tabs and SGR colour and drops everything
else. Only ESC starts a sequence, as in a UTF-8 terminal, so combining
marks survive and a cut-off rune becomes U+FFFD instead of swallowing the
text after it.

Every entry now goes through displayEntry, the one owner of that pipeline.
@tdwd
tdwd merged commit bb2e3d0 into main Oct 15, 2026
1 check passed
@tdwd
tdwd deleted the fix-transcript-cutoff branch October 15, 2026 15:52
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