Skip to content

Commit 18c583d

Browse files
Merge pull request #539 from JordanMartinez/cleanup
Remove unused method/import; use caret's target caret offset, not area's
2 parents 2e2f5db + 9a75fee commit 18c583d

1 file changed

Lines changed: 1 addition & 27 deletions

File tree

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

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
import java.util.function.IntFunction;
1616
import java.util.function.IntSupplier;
1717
import java.util.function.IntUnaryOperator;
18-
import java.util.function.UnaryOperator;
19-
import java.util.stream.Collectors;
2018

2119
import javafx.beans.NamedArg;
2220
import javafx.beans.binding.Binding;
@@ -500,9 +498,6 @@ public Optional<Tuple2<Codec<PS>, Codec<SEG>>> getStyleCodecs() {
500498

501499
private Subscription subscriptions = () -> {};
502500

503-
// Remembers horizontal position when traversing up / down.
504-
private Optional<ParagraphBox.CaretOffsetX> targetCaretOffset = Optional.empty();
505-
506501
private final VirtualFlow<Paragraph<PS, SEG, S>, Cell<Paragraph<PS, SEG, S>, ParagraphBox<PS, SEG, S>>> virtualFlow;
507502

508503
// used for two-level navigation, where on the higher level are
@@ -707,18 +702,6 @@ public GenericStyledArea(
707702
* *
708703
* ********************************************************************** */
709704

710-
/**
711-
* Returns caret bounds relative to the viewport, i.e. the visual bounds
712-
* of the embedded VirtualFlow.
713-
*/
714-
Optional<Bounds> getCaretBoundsInViewport() {
715-
return virtualFlow.getCellIfVisible(getCurrentParagraph())
716-
.map(c -> {
717-
Bounds cellBounds = c.getNode().getCaretBounds();
718-
return virtualFlow.cellToViewport(c, cellBounds);
719-
});
720-
}
721-
722705
/**
723706
* Returns x coordinate of the caret in the current paragraph.
724707
*/
@@ -1010,10 +993,6 @@ public void scrollBy(Point2D deltas) {
1010993
suspendVisibleParsWhile(() -> virtualFlow.scrollBy(deltas));
1011994
}
1012995

1013-
void show(double y) {
1014-
suspendVisibleParsWhile(() -> virtualFlow.show(y));
1015-
}
1016-
1017996
@Override
1018997
public void showParagraphInViewport(int paragraphIndex) {
1019998
suspendVisibleParsWhile(() -> virtualFlow.show(paragraphIndex));
@@ -1288,11 +1267,6 @@ private Optional<Bounds> getRangeBoundsOnScreen(int paragraphIndex, int from, in
12881267
.map(c -> c.getNode().getRangeBoundsOnScreen(from, to));
12891268
}
12901269

1291-
private Optional<Bounds> getCaretBoundsOnScreen() {
1292-
return virtualFlow.getCellIfVisible(getCurrentParagraph())
1293-
.map(c -> c.getNode().getCaretBoundsOnScreen());
1294-
}
1295-
12961270
public final Optional<Bounds> getCaretBoundsOnScreen(int paragraphIndex) {
12971271
return virtualFlow.getCellIfVisible(paragraphIndex)
12981272
.map(c -> c.getNode().getCaretBoundsOnScreen());
@@ -1366,7 +1340,7 @@ private void suspendVisibleParsWhile(Runnable runnable) {
13661340
}
13671341

13681342
void clearTargetCaretOffset() {
1369-
targetCaretOffset = Optional.empty();
1343+
mainCaret.clearTargetOffset();
13701344
}
13711345

13721346
ParagraphBox.CaretOffsetX getTargetCaretOffset() {

0 commit comments

Comments
 (0)