From 93e48e8cf18610bfb3f88ccd29891b2959dd606b Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Mon, 17 Nov 2014 12:32:06 -0800 Subject: [PATCH] Fix missing ellipsis when just one character is truncated The "moreChars" test in StaticLayout's generate method would evaluate to false when the last character in a word caused the break. This in turn suppressed the ellipsis in this case. The proposed fix is always to set moreChars true in the code path where the line is broken because more text wouldn't fit. Bug: 17738112 Change-Id: Ifa1a69841ca952da4d1937dc8326778179b026b3 --- core/java/android/text/StaticLayout.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/java/android/text/StaticLayout.java b/core/java/android/text/StaticLayout.java index 70ad3f0c5892e..6cb73ea08a8b5 100644 --- a/core/java/android/text/StaticLayout.java +++ b/core/java/android/text/StaticLayout.java @@ -355,14 +355,12 @@ public class StaticLayout extends Layout { while (breakIndex < breakCount && paraStart + breaks[breakIndex] <= spanEnd) { int endPos = paraStart + breaks[breakIndex]; - boolean moreChars = (endPos < paraEnd); // XXX is this the right way to calculate this? - v = out(source, here, endPos, fmAscent, fmDescent, fmTop, fmBottom, v, spacingmult, spacingadd, chooseHt,chooseHtv, fm, flags[breakIndex], needMultiply, chdirs, dir, easy, bufEnd, includepad, trackpad, chs, widths, paraStart, ellipsize, ellipsizedWidth, - lineWidths[breakIndex], paint, moreChars); + lineWidths[breakIndex], paint, true); if (endPos < spanEnd) { // preserve metrics for current span