From 455786e30a8a1ad1e66cd3472e3a02d57ee49f03 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 4 Jun 2018 13:28:38 -0700 Subject: [PATCH] libtxt: fix bug in calculating line end positions excluding whitespace (flutter/engine#5459) Fixes https://github.com/flutter/flutter/issues/18014 --- engine/src/flutter/third_party/txt/src/txt/paragraph.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/src/flutter/third_party/txt/src/txt/paragraph.cc b/engine/src/flutter/third_party/txt/src/txt/paragraph.cc index a2fd816a84..1ece631fd5 100644 --- a/engine/src/flutter/third_party/txt/src/txt/paragraph.cc +++ b/engine/src/flutter/third_party/txt/src/txt/paragraph.cc @@ -303,7 +303,7 @@ bool Paragraph::ComputeLineBreaks() { (hard_break && line_end < text_.size()) ? line_end + 1 : line_end; size_t line_end_excluding_whitespace = line_end; while ( - line_end_excluding_whitespace > 0 && + line_end_excluding_whitespace > line_start && minikin::isLineEndSpace(text_[line_end_excluding_whitespace - 1])) { line_end_excluding_whitespace--; }