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 dd1c7e6718..ff017b661b 100644 --- a/engine/src/flutter/third_party/txt/src/txt/paragraph.cc +++ b/engine/src/flutter/third_party/txt/src/txt/paragraph.cc @@ -479,8 +479,12 @@ void Paragraph::Layout(double width, bool force) { } } - // Exclude trailing whitespace from right-justified lines so the last - // visible character in the line will be flush with the right margin. + // TODO(garyq): Make GetRectsForRange return a zero-width box for the + // excluded whitespace such that the caret placement is correct regardless + // of the index being whitespace or not. + + // Exclude trailing whitespace from right and center-justified lines so the + // last visible character in the line will be flush with the right margin. size_t line_end_index = (paragraph_style_.effective_align() == TextAlign::right || paragraph_style_.effective_align() == TextAlign::center)