@@ -117,7 +117,7 @@ public DynamicLayout(CharSequence base, CharSequence display,
117117
118118 mObjects = new PackedObjectVector <Directions >(1 );
119119
120- mBlockEnds = new int [] { 0 };
120+ mBlockEndLines = new int [] { 0 };
121121 mBlockIndices = new int [] { INVALID_BLOCK_INDEX };
122122 mNumberOfBlocks = 1 ;
123123
@@ -391,23 +391,23 @@ void updateBlocks(int startLine, int endLine, int newLineCount) {
391391 int firstBlock = -1 ;
392392 int lastBlock = -1 ;
393393 for (int i = 0 ; i < mNumberOfBlocks ; i ++) {
394- if (mBlockEnds [i ] >= startLine ) {
394+ if (mBlockEndLines [i ] >= startLine ) {
395395 firstBlock = i ;
396396 break ;
397397 }
398398 }
399399 for (int i = firstBlock ; i < mNumberOfBlocks ; i ++) {
400- if (mBlockEnds [i ] >= endLine ) {
400+ if (mBlockEndLines [i ] >= endLine ) {
401401 lastBlock = i ;
402402 break ;
403403 }
404404 }
405- final int lastBlockEndLine = mBlockEnds [lastBlock ];
405+ final int lastBlockEndLine = mBlockEndLines [lastBlock ];
406406
407407 boolean createBlockBefore = startLine > (firstBlock == 0 ? 0 :
408- mBlockEnds [firstBlock - 1 ] + 1 );
408+ mBlockEndLines [firstBlock - 1 ] + 1 );
409409 boolean createBlock = newLineCount > 0 ;
410- boolean createBlockAfter = endLine < mBlockEnds [lastBlock ];
410+ boolean createBlockAfter = endLine < mBlockEndLines [lastBlock ];
411411
412412 int numAddedBlocks = 0 ;
413413 if (createBlockBefore ) numAddedBlocks ++;
@@ -419,52 +419,52 @@ void updateBlocks(int startLine, int endLine, int newLineCount) {
419419
420420 if (newNumberOfBlocks == 0 ) {
421421 // Even when text is empty, there is actually one line and hence one block
422- mBlockEnds [0 ] = 0 ;
422+ mBlockEndLines [0 ] = 0 ;
423423 mBlockIndices [0 ] = INVALID_BLOCK_INDEX ;
424424 mNumberOfBlocks = 1 ;
425425 return ;
426426 }
427427
428- if (newNumberOfBlocks > mBlockEnds .length ) {
428+ if (newNumberOfBlocks > mBlockEndLines .length ) {
429429 final int newSize = ArrayUtils .idealIntArraySize (newNumberOfBlocks );
430- int [] blockEnds = new int [newSize ];
430+ int [] blockEndLines = new int [newSize ];
431431 int [] blockIndices = new int [newSize ];
432- System .arraycopy (mBlockEnds , 0 , blockEnds , 0 , firstBlock );
432+ System .arraycopy (mBlockEndLines , 0 , blockEndLines , 0 , firstBlock );
433433 System .arraycopy (mBlockIndices , 0 , blockIndices , 0 , firstBlock );
434- System .arraycopy (mBlockEnds , lastBlock + 1 ,
435- blockEnds , firstBlock + numAddedBlocks , mNumberOfBlocks - lastBlock - 1 );
434+ System .arraycopy (mBlockEndLines , lastBlock + 1 ,
435+ blockEndLines , firstBlock + numAddedBlocks , mNumberOfBlocks - lastBlock - 1 );
436436 System .arraycopy (mBlockIndices , lastBlock + 1 ,
437437 blockIndices , firstBlock + numAddedBlocks , mNumberOfBlocks - lastBlock - 1 );
438- mBlockEnds = blockEnds ;
438+ mBlockEndLines = blockEndLines ;
439439 mBlockIndices = blockIndices ;
440440 } else {
441- System .arraycopy (mBlockEnds , lastBlock + 1 ,
442- mBlockEnds , firstBlock + numAddedBlocks , mNumberOfBlocks - lastBlock - 1 );
441+ System .arraycopy (mBlockEndLines , lastBlock + 1 ,
442+ mBlockEndLines , firstBlock + numAddedBlocks , mNumberOfBlocks - lastBlock - 1 );
443443 System .arraycopy (mBlockIndices , lastBlock + 1 ,
444444 mBlockIndices , firstBlock + numAddedBlocks , mNumberOfBlocks - lastBlock - 1 );
445445 }
446446
447447 mNumberOfBlocks = newNumberOfBlocks ;
448448 final int deltaLines = newLineCount - (endLine - startLine + 1 );
449449 for (int i = firstBlock + numAddedBlocks ; i < mNumberOfBlocks ; i ++) {
450- mBlockEnds [i ] += deltaLines ;
450+ mBlockEndLines [i ] += deltaLines ;
451451 }
452452
453453 int blockIndex = firstBlock ;
454454 if (createBlockBefore ) {
455- mBlockEnds [blockIndex ] = startLine - 1 ;
455+ mBlockEndLines [blockIndex ] = startLine - 1 ;
456456 mBlockIndices [blockIndex ] = INVALID_BLOCK_INDEX ;
457457 blockIndex ++;
458458 }
459459
460460 if (createBlock ) {
461- mBlockEnds [blockIndex ] = startLine + newLineCount - 1 ;
461+ mBlockEndLines [blockIndex ] = startLine + newLineCount - 1 ;
462462 mBlockIndices [blockIndex ] = INVALID_BLOCK_INDEX ;
463463 blockIndex ++;
464464 }
465465
466466 if (createBlockAfter ) {
467- mBlockEnds [blockIndex ] = lastBlockEndLine + deltaLines ;
467+ mBlockEndLines [blockIndex ] = lastBlockEndLine + deltaLines ;
468468 mBlockIndices [blockIndex ] = INVALID_BLOCK_INDEX ;
469469 }
470470 }
@@ -473,19 +473,19 @@ void updateBlocks(int startLine, int endLine, int newLineCount) {
473473 * This package private method is used for test purposes only
474474 * @hide
475475 */
476- void setBlocksDataForTest (int [] blockEnds , int [] blockIndices , int numberOfBlocks ) {
477- mBlockEnds = new int [blockEnds .length ];
476+ void setBlocksDataForTest (int [] blockEndLines , int [] blockIndices , int numberOfBlocks ) {
477+ mBlockEndLines = new int [blockEndLines .length ];
478478 mBlockIndices = new int [blockIndices .length ];
479- System .arraycopy (blockEnds , 0 , mBlockEnds , 0 , blockEnds .length );
479+ System .arraycopy (blockEndLines , 0 , mBlockEndLines , 0 , blockEndLines .length );
480480 System .arraycopy (blockIndices , 0 , mBlockIndices , 0 , blockIndices .length );
481481 mNumberOfBlocks = numberOfBlocks ;
482482 }
483483
484484 /**
485485 * @hide
486486 */
487- public int [] getBlockEnds () {
488- return mBlockEnds ;
487+ public int [] getBlockEndLines () {
488+ return mBlockEndLines ;
489489 }
490490
491491 /**
@@ -633,8 +633,8 @@ public int getEllipsisCount(int line) {
633633 * @hide
634634 */
635635 public static final int INVALID_BLOCK_INDEX = -1 ;
636- // Stores the line numbers of the last line of each block
637- private int [] mBlockEnds ;
636+ // Stores the line numbers of the last line of each block (inclusive)
637+ private int [] mBlockEndLines ;
638638 // The indices of this block's display list in TextView's internal display list array or
639639 // INVALID_BLOCK_INDEX if this block has been invalidated during an edition
640640 private int [] mBlockIndices ;
0 commit comments