Skip to content

Newlines fix, add support multiline labels#41

Open
GrigoriiTarasov wants to merge 2 commits intotvst:masterfrom
GrigoriiTarasov:master
Open

Newlines fix, add support multiline labels#41
GrigoriiTarasov wants to merge 2 commits intotvst:masterfrom
GrigoriiTarasov:master

Conversation

@GrigoriiTarasov
Copy link
Copy Markdown

@GrigoriiTarasov GrigoriiTarasov commented Jun 10, 2024

Currently first newline is ignored and 2nd and more breaks background both for content and label (with or without spaces between)

[Pic1 Example from #21 few text old/current version]

This commit adds the argument "newline_mode"
with options:
1) 'old' (default) - As is now: ignores first consequential \n, breaks background on second. Nothing changed.

[Pic2 Lots of text old/current version]

2) 'flex' - Writes all newlines. Background fixed for both label and content. Each annotation is grouped in box having same label on the side (as side effect of display inline-flex preserved)

[Pic3 Few text flex option]

[Pic4 Lots of text flex option]

3) 'multiline' - writes all newlines with proper background for content. Lines are preserved (by display inline instead of inline-flex).

[Pic5 Few text multiline option]

[Pic6 Lots of text multiline option]

Default behavior is the old one thus it backward-compatible.
It resolves #21 and gives newline handling in unified and predictable fashion.

@fkdosilovic
Copy link
Copy Markdown

This would be a great fix for the component. (Just leaving a comment to show the importance of the fix for the community :) ).

Copy link
Copy Markdown
Collaborator

@blackary blackary left a comment

Choose a reason for hiding this comment

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

LGTM -- what do you think @tvst?

@feljost
Copy link
Copy Markdown

feljost commented Sep 3, 2025

@tvst @blackary I would greatly appreciate this feature in a new release. If possible, could this be merged and a new pip release be made?

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.

Issue with newline characters

4 participants