Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ public static TextExt createStyledTextNode(Consumer<TextExt> applySegment) {
TextExt t = new TextExt();
t.setTextOrigin(VPos.TOP);
applySegment.accept(t);

// XXX: binding selectionFill to textFill,
// see the note at highlightTextFill
t.impl_selectionFillProperty().bind(t.fillProperty());
return t;
}
}
14 changes: 11 additions & 3 deletions richtextfx/src/main/java/org/fxmisc/richtext/ParagraphText.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,15 @@ public ObjectProperty<Paint> highlightTextFillProperty() {
// });

// populate with text nodes
par.getStyledSegments().stream().map(nodeFactory).forEach(getChildren()::add);
par.getStyledSegments().stream().map(nodeFactory).forEach(n -> {
if (n instanceof TextExt) {
TextExt t = (TextExt) n;
// XXX: binding selectionFill to textFill,
// see the note at highlightTextFill
t.impl_selectionFillProperty().bind(t.fillProperty());
}
getChildren().add(n);
});

// set up custom css shape helpers
Supplier<Path> createBackgroundShape = () -> {
Expand Down Expand Up @@ -406,8 +414,8 @@ private void updateSharedShapeRange(T value, int start, int end) {
T lastShapeValue = lastShapeValueRange._1;

// calculate smallest possible position which is consecutive to the given start position
final int prevEndNext = lastShapeValueRange.get2().getEnd() + 1;
if (start <= prevEndNext && // Consecutive?
final int prevEndNext = lastShapeValueRange.get2().getEnd() + 1;
if (start <= prevEndNext && // Consecutive?
lastShapeValue.equals(value)) { // Same style?

IndexRange lastRange = lastShapeValueRange._2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ public static <S> Node createStyledTextNode(String text, S style,
t.setTextOrigin(VPos.TOP);
t.getStyleClass().add("text");
applyStyle.accept(t, style);

// XXX: binding selectionFill to textFill,
// see the note at highlightTextFill
t.impl_selectionFillProperty().bind(t.fillProperty());
return t;
}
}