fix(tui): blockquote multiline rendering and wrapping #1073
+214
−21
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.
Fix two bugs in blockquote rendering:
ANSI codes split incorrectly on newlines - when text tokens contain newlines, styling was applied to the entire string including the newline. Any caller splitting by
\nwould break the ANSI codes, causing inconsistent coloring (e.g., first line pink, second line grey).Wrapped blockquote lines lost the │ border - long blockquote lines that wrapped to multiple lines only had the border on the first line.
Solution
Refactored
renderInlineTokensto use a style context instead of a boolean flag:applyDefaultStyle()for normal texttheme.quote(theme.italic(text))stylePrefixAlso added handling for
paragraphtokens insiderenderInlineTokens- these appear in blockquotes and need to propagate the style context to their nested inline tokens.Tests
Added regression tests for:
>Foo\nbar)>Foo\n>bar)> Quote with **bold** and \code``)Session: https://buildwithpi.ai/session/#95f37a58d17decb975c4d57085737421