Skip to content

Commit 1e550d9

Browse files
Rename navigator to clarify usage; remove middle-man method
1 parent 343499b commit 1e550d9

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ public Optional<Tuple2<Codec<PS>, Codec<StyledSegment<SEG, S>>>> getStyleCodecs(
551551

552552
// used for two-level navigation, where on the higher level are
553553
// paragraphs and on the lower level are lines within a paragraph
554-
private final TwoLevelNavigator navigator;
554+
private final TwoLevelNavigator paragraphLineNavigator;
555555

556556
private boolean followCaretRequested = false;
557557

@@ -724,7 +724,7 @@ public GenericStyledArea(
724724
// initialize navigator
725725
IntSupplier cellCount = () -> getParagraphs().size();
726726
IntUnaryOperator cellLength = i -> virtualFlow.getCell(i).getNode().getLineCount();
727-
navigator = new TwoLevelNavigator(cellCount, cellLength);
727+
paragraphLineNavigator = new TwoLevelNavigator(cellCount, cellLength);
728728

729729
viewportDirty = merge(
730730
// no need to check for width & height invalidations as scroll values update when these do
@@ -891,7 +891,7 @@ TwoDimensional.Position currentLine() {
891891
int parIdx = getCurrentParagraph();
892892
Cell<Paragraph<PS, SEG, S>, ParagraphBox<PS, SEG, S>> cell = virtualFlow.getCell(parIdx);
893893
int lineIdx = cell.getNode().getCurrentLineIndex();
894-
return _position(parIdx, lineIdx);
894+
return paragraphLineNavigator.position(parIdx, lineIdx);
895895
}
896896

897897
@Override
@@ -900,10 +900,6 @@ public final int lineIndex(int paragraphIndex, int columnPosition) {
900900
return cell.getNode().getCurrentLineIndex(columnPosition);
901901
}
902902

903-
TwoDimensional.Position _position(int par, int line) {
904-
return navigator.position(par, line);
905-
}
906-
907903
@Override
908904
public int getParagraphLinesCount(int paragraphIndex) {
909905
return virtualFlow.getCell(paragraphIndex).getNode().getLineCount();

0 commit comments

Comments
 (0)