Skip to content

fix(text): preserve newlines between rich text runs - #1183

Open
MohamedSharfan wants to merge 1 commit into
ecomfe:masterfrom
MohamedSharfan:fix-21813-rich-text-newlines
Open

MohamedSharfan wants to merge 1 commit into
ecomfe:masterfrom
MohamedSharfan:fix-21813-rich-text-newlines

Conversation

@MohamedSharfan

Copy link
Copy Markdown

Summary

Preserve explicit newlines when rich text is wrapped with overflow: 'break' or overflow: 'breakAll'.

Root cause

wrapText() omitted the final empty line when its input ended in \n. This caused the following rich-text run to be appended to the previous line.

Solution

Keep the final empty line when the text ends in a newline. This also preserves consecutive and trailing newlines without changing truncate behavior.

Visual proof

Before — rich-text runs collapse onto one line

image

After — explicit newline is preserved

image

Tests

  • Added regression coverage for rich-text runs, plain/rich text boundaries, leading/trailing/consecutive newlines, and newline-only text.
  • Verified break, breakAll, truncate, and automatic wrapping.

Related issue

Related to apache/echarts#21813

Copilot AI balanced review requested due to automatic review settings November 7, 2026 14:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

This branch has not been deployed

No deployments
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.

2 participants