Do not wrap empty lines

This commit is contained in:
Jeremy Soller 2022-12-08 11:33:36 -07:00
parent 3d60d55309
commit dd94bc634b
No known key found for this signature in database
GPG key ID: 87F211AF2BE4C2FE

View file

@ -2,9 +2,7 @@
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use unicode_bidi::Level;
use core::mem;
use core::ops::Range;
use unicode_script::{Script, UnicodeScript};
use unicode_segmentation::UnicodeSegmentation;
@ -622,7 +620,7 @@ impl ShapeLine {
x + x_advance > end_x
};
if glyph_wrap {
if glyph_wrap && ! glyphs.is_empty() {
let mut glyphs_swap = Vec::new();
mem::swap(&mut glyphs, &mut glyphs_swap);
layout_lines.push(
@ -649,7 +647,7 @@ impl ShapeLine {
}
}
if wrap {
if wrap && ! glyphs.is_empty() {
let mut glyphs_swap = Vec::new();
mem::swap(&mut glyphs, &mut glyphs_swap);
layout_lines.push(