fix(richcontent): preserve blank lines before inline profile/hashtag segments#603
Open
dmnyc wants to merge 1 commit into
Open
fix(richcontent): preserve blank lines before inline profile/hashtag segments#603dmnyc wants to merge 1 commit into
dmnyc wants to merge 1 commit into
Conversation
…segments The trimBlankLines pass was stripping \n\n before NostrProfileSegment and HashtagSegment, treating them as block-level elements. They are inline — they share a Text() composable with surrounding text and get no extra Column spacing — so blank lines before them must be preserved. Notes whose paragraphs start with a nostr: mention lost all paragraph spacing on Android as a result.
3 tasks
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.
Summary
Notes whose paragraphs start with a `nostr:` profile mention were missing blank lines between paragraphs on Android. iOS was unaffected because it renders note content through a different path.
Root cause
`parseContent()` has a final pass (`trimBlankLines`) that trims trailing `\n\n` from a `TextSegment` when the next segment is a block-level element (image, embed, standalone link). This prevents double-spacing when a `Column` with `Arrangement.spacedBy(8.dp)` adds its own gap before the block.
However, `NostrProfileSegment` and `HashtagSegment` were not in the exclusion list, even though they are inline — they share a single `Text()` composable with surrounding text and receive no extra Column spacing. Any `\n\n` before them was silently collapsed to `\n`.
A note crediting several people (each paragraph starting with a `nostr:npub` mention) lost every blank line between paragraphs.
Fix
One-line change: add `NostrProfileSegment` and `HashtagSegment` to the same exclusion list already used for `TextSegment`, `InlineLinkSegment`, and `CustomEmojiSegment`.
Test plan
🤖 Generated with Claude Code