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
This commit is contained in:
Raph Levien
2014-11-17 12:32:06 -08:00
committed by Chris Craik
parent 10e4a45f69
commit 93e48e8cf1

View File

@@ -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