From dd94bc634b9aac6ec1eb34f5f439140d2a7bcb35 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 8 Dec 2022 11:33:36 -0700 Subject: [PATCH] Do not wrap empty lines --- src/shape.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/shape.rs b/src/shape.rs index 00d4501..0ad1bee 100644 --- a/src/shape.rs +++ b/src/shape.rs @@ -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(