Skip to content

Replace use of str::Lines with unicode-bidi-based iterator#124

Merged
jackpot51 merged 4 commits intopop-os:mainfrom
tigregalis:iter-bidi-para
Jun 9, 2023
Merged

Replace use of str::Lines with unicode-bidi-based iterator#124
jackpot51 merged 4 commits intopop-os:mainfrom
tigregalis:iter-bidi-para

Conversation

@tigregalis
Copy link
Copy Markdown
Contributor

Fixes #74

Alternative to #102 which this PR adapts the logic from.

The motivation for making this public is that any consumer of cosmic text that needs to construct buffers by pushing buffer lines needs to be able to split text into paragraphs, and this prevents re-implementation of this logic by every downstream consumer of cosmic text.

Usage is seamless:

+ use cosmic_text::BidiParagraphs;
-     for line in text.lines() {
+     for line in BidiParagraphs::new(&text) {

@tigregalis
Copy link
Copy Markdown
Contributor Author

I've resolved the conflict.

@tigregalis tigregalis changed the title Replace use of str::lines with unicode-bidi-based iterator Replace use of str::Lines with unicode-bidi-based iterator Jun 9, 2023
@jackpot51 jackpot51 merged commit b5f45f8 into pop-os:main Jun 9, 2023
StewartCanva pushed a commit to StewartCanva/cosmic-text that referenced this pull request Jun 26, 2025
Replace use of `str::Lines` with `unicode-bidi`-based iterator
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.

assertion failed when source text contains \r character

2 participants