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 @@ -43,9 +43,9 @@ int getLineStartPosition(int charIdx) {
4343
4444 int getLineEndPosition (int charIdx ) {
4545 TwoLevelNavigator navigator = textLayout ().getTwoLevelNavigator ();
46- int currentLineIndex = navigator .offsetToPosition (charIdx , Forward ).getMajor ();
47- int minor = (currentLineIndex == getLineCount () - 1 ) ? 0 : -1 ;
48- return navigator .position (currentLineIndex + 1 , minor ).toOffset ();
46+ int currentLineIndex = navigator .offsetToPosition (charIdx , Forward ).getMajor () + 1 ;
47+ int minor = (currentLineIndex == getLineCount ()) ? 0 : -1 ;
48+ return navigator .position (currentLineIndex , minor ).toOffset ();
4949 }
5050
5151 int getLineOfCharacter (int charIdx ) {
Original file line number Diff line number Diff line change @@ -66,7 +66,8 @@ TwoLevelNavigator getTwoLevelNavigator() {
6666 int getLineCount () {
6767
6868 if ( lineCount > -1 ) return lineCount ;
69-
69+
70+ lineCount = 0 ;
7071 lineMetrics .clear ();
7172 double totLines = 0.0 , prevMinY = 1.0 , prevMaxY = -1.0 ;
7273 int totCharSoFar = 0 ;
You can’t perform that action at this time.
0 commit comments