From 63b3d8c62ef24121f40b2262e89b3f37527beab3 Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Thu, 3 Apr 2014 15:52:08 -0700 Subject: [PATCH] Fix extra text appearing after ellipsis This is a fix for bug 7615701 TextView: calling setText with long strings causes ellipsize to not work correctly. The problem is that the "break" when the last line was ellipsized did not fully break out of both loops of the processing logic, but only the inner loop. This caused the outer loop to restart at the next span, causing the next span boundary to overwrite the line end of the last visible line. The fix simply returns from the function in that case, as there is no further processing needing to be done. Change-Id: I5b34233ffba6f0f6f1c12b9565b4fc53e83a4892 --- core/java/android/text/StaticLayout.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/text/StaticLayout.java b/core/java/android/text/StaticLayout.java index 535eee1397edc..638ef22fe3e20 100644 --- a/core/java/android/text/StaticLayout.java +++ b/core/java/android/text/StaticLayout.java @@ -433,7 +433,7 @@ public class StaticLayout extends Layout { } if (mLineCount >= mMaximumVisibleLineCount) { - break; + return; } } }