File tree Expand file tree Collapse file tree
richtextfx/src/main/java9/org/fxmisc/richtext Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ int getLineCount() {
7272
7373 lineCount = 0 ;
7474 lineMetrics .clear ();
75- double totLines = 0.0 , prevMinY = 1.0 , prevMaxY = -1.0 ;
75+ double totLines = 0.0 , prevMaxY = -1.0 ;
7676 int totCharSoFar = 0 ;
7777
7878 for ( Node n : flow .getChildren () ) if ( n .isManaged () ) {
@@ -83,8 +83,8 @@ int getLineCount() {
8383 double lines = Math .max ( 1.0 , Math .floor ( shape .length / 5 ) );
8484 double nodeMinY = Math .max ( 0.0 , nodeBounds .getMinY () );
8585
86- if ( nodeMinY >= prevMinY && lines > 1 ) totLines += lines - 1 ; // Multiline Text node
87- else if ( nodeMinY >= prevMaxY ) totLines += lines ;
86+ if ( nodeMinY >= prevMaxY ) totLines += lines ;
87+ else if ( lines > 1 ) totLines += lines - 1 ; // Staggered multiline text node
8888
8989 if ( lineMetrics .size () < totLines ) { // Add additional lines
9090
@@ -120,8 +120,7 @@ int getLineCount() {
120120 totCharSoFar += length ;
121121 }
122122
123- prevMaxY = nodeBounds .getMaxY ();
124- prevMinY = nodeMinY ;
123+ prevMaxY = Math .max ( prevMaxY , nodeBounds .getMaxY () );
125124 }
126125
127126 lineCount = (int ) totLines ;
You can’t perform that action at this time.
0 commit comments