Skip to content

caching ns richtext#2056

Merged
Tlaster merged 2 commits intomasterfrom
bugfix/uikit-richtext
Apr 25, 2026
Merged

caching ns richtext#2056
Tlaster merged 2 commits intomasterfrom
bugfix/uikit-richtext

Conversation

@Tlaster
Copy link
Copy Markdown
Contributor

@Tlaster Tlaster commented Apr 25, 2026

No description provided.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c2099b83bd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +166 to +170
if let truncatedText = text.truncatedText, !truncatedText.isEmpty {
inlineImages.removeAll(keepingCapacity: true)
addPlainTextContent(truncatedText)
invalidateIntrinsicContentSize()
return
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Skip hard truncation when full rich text is requested

This branch truncates every UiRichText longer than 500 characters before lineLimit is considered, so callers that intentionally request full content (for example, detail/expanded paths in StatusUIKitView.buildContentColumnList that use lineLimit = nil) can no longer render the full post. Because it routes to addPlainTextContent, long posts also lose rich runs (links, styling, inline images) even after the user expands.

Useful? React with 👍 / 👎.

}
}
public val isLongText: Boolean = innerText.codePointCount() > 500
public val truncatedText: String? = if (isLongText) innerText.take(500) + "…" else null
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Truncate by code points, not UTF-16 units

isLongText is computed with codePointCount(), but truncatedText uses innerText.take(500), which cuts by UTF-16 code units. For strings containing supplementary characters (e.g. emoji), this can truncate much earlier than 500 code points and may split a surrogate pair at the boundary, producing malformed output; the truncation path should use a code-point-safe substring to match the threshold.

Useful? React with 👍 / 👎.

@Tlaster Tlaster merged commit db8dcff into master Apr 25, 2026
8 checks passed
@Tlaster Tlaster deleted the bugfix/uikit-richtext branch April 25, 2026 10:15
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