Merge pull request #124 from tigregalis/iter-bidi-para

Replace use of `str::Lines` with `unicode-bidi`-based iterator
This commit is contained in:
Jeremy Soller 2023-06-09 07:03:07 -06:00 committed by GitHub
commit b5f45f81f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 6 deletions

View file

@ -9,8 +9,8 @@ use core::{cmp, fmt};
use unicode_segmentation::UnicodeSegmentation;
use crate::{
Attrs, AttrsList, BorrowedWithFontSystem, BufferLine, Color, FontSystem, LayoutGlyph,
LayoutLine, ShapeLine, Shaping, Wrap,
Attrs, AttrsList, BidiParagraphs, BorrowedWithFontSystem, BufferLine, Color, FontSystem,
LayoutGlyph, LayoutLine, ShapeLine, Shaping, Wrap,
};
/// Current cursor location
@ -594,7 +594,7 @@ impl Buffer {
shaping: Shaping,
) {
self.lines.clear();
for line in text.lines() {
for line in BidiParagraphs::new(text) {
self.lines.push(BufferLine::new(
line.to_string(),
AttrsList::new(attrs),