Skip to content

fix(richcontent): preserve blank lines before inline profile/hashtag segments#603

Open
dmnyc wants to merge 1 commit into
barrydeen:mainfrom
dmnyc:fix/linebreaks-before-mentions
Open

fix(richcontent): preserve blank lines before inline profile/hashtag segments#603
dmnyc wants to merge 1 commit into
barrydeen:mainfrom
dmnyc:fix/linebreaks-before-mentions

Conversation

@dmnyc

@dmnyc dmnyc commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

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

  • Open a note where paragraphs start with `nostr:` profile mentions — blank lines now visible
  • Notes with images/videos still show no double-spacing before media
  • Notes with embedded quoted notes still trim correctly

🤖 Generated with Claude Code

…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.
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