Skip to content

Comments

Text: Add max-lines support and cap preferred height to visible line limit#10839

Open
amirHdev wants to merge 1 commit intoslint-ui:masterfrom
amirHdev:feat-text-max-lines-10799
Open

Text: Add max-lines support and cap preferred height to visible line limit#10839
amirHdev wants to merge 1 commit intoslint-ui:masterfrom
amirHdev:feat-text-max-lines-10799

Conversation

@amirHdev
Copy link
Contributor

@amirHdev amirHdev commented Feb 20, 2026

Summary

This change adds support for limiting the number of visible lines in Text/StyledText via a new max-lines property.

It also ensures layout sizing matches that behavior by capping preferred vertical size to the configured visible line limit.

Fixes #10799

Changes

  • Added max-lines to text builtins:
    • SimpleText (inherited by ComplexText)
    • StyledTextItem
  • Added runtime plumbing for max_lines through RenderText.
  • Updated text layout info to cap preferred/min vertical size when max-lines is set.
  • Applied line limiting in both rendering/layout paths:
    • software text layout (TextParagraphLayout)
    • shared parley layout/draw path
  • Added/updated text layout tests for line-limiting behavior.

Behavior

  • max-lines <= 0 means no line limit.
  • When max-lines is set, rendering is limited to that many visible lines.
  • Preferred height does not exceed the configured number of lines.

Notes

  • This aligns with expected layout behavior for stacked text items (next items are laid out immediately after capped text height).

@amirHdev amirHdev force-pushed the feat-text-max-lines-10799 branch from ce5dc5d to dce83b3 Compare February 20, 2026 17:30
- add max-lines property to text builtins and runtime items\n- cap text preferred vertical layout to configured line count\n- apply max-lines in software and parley text layout/rendering paths\n- add textlayout coverage for line-limiting behavior\n- compute line height from ascent/descent\n- use Coord typing for max-lines multiplication in int-coordinate builds

Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
@amirHdev amirHdev force-pushed the feat-text-max-lines-10799 branch from dce83b3 to 9c97b3a Compare February 20, 2026 17:33
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.

Text: Add support for limiting the number of logical lines

1 participant