Skip to content

Commit 4cc49c3

Browse files
authored
Fix custom fold CSS not being applied (#1000)
1 parent b813861 commit 4cc49c3

2 files changed

Lines changed: 6 additions & 11 deletions

File tree

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import javafx.scene.paint.Paint;
1818
import javafx.scene.text.Font;
1919
import javafx.scene.text.FontPosture;
20+
import javafx.scene.text.FontWeight;
2021

2122
import org.reactfx.collection.LiveList;
2223
import org.reactfx.value.Val;
@@ -29,10 +30,9 @@ public class LineNumberFactory<PS> implements IntFunction<Node> {
2930

3031
private static final Insets DEFAULT_INSETS = new Insets(0.0, 5.0, 0.0, 5.0);
3132
private static final Paint DEFAULT_TEXT_FILL = Color.web("#666");
32-
private static final Font DEFAULT_FONT =
33-
Font.font("monospace", FontPosture.ITALIC, 13);
34-
private static final Background DEFAULT_BACKGROUND =
35-
new Background(new BackgroundFill(Color.web("#ddd"), null, null));
33+
private static final Font DEFAULT_FONT = Font.font("monospace", FontPosture.ITALIC, 13);
34+
private static final Font DEFAULT_FOLD_FONT = Font.font("monospace", FontWeight.BOLD, 13);
35+
private static final Background DEFAULT_BACKGROUND = new Background(new BackgroundFill(Color.web("#ddd"), null, null));
3636

3737
public static IntFunction<Node> get(GenericStyledArea<?, ?, ?> area) {
3838
return get(area, digits -> "%1$" + digits + "s");
@@ -113,7 +113,8 @@ public Node apply(int idx) {
113113
if ( isFoldedCheck != null )
114114
{
115115
Label foldIndicator = new Label( " " );
116-
foldIndicator.setTextFill( DEFAULT_TEXT_FILL ); // Prevents CSS errors
116+
foldIndicator.setTextFill( Color.BLUE ); // Prevents CSS errors
117+
foldIndicator.setFont( DEFAULT_FOLD_FONT );
117118

118119
lineNo.setContentDisplay( ContentDisplay.RIGHT );
119120
lineNo.setGraphic( foldIndicator );

richtextfx/src/main/resources/org/fxmisc/richtext/styled-text-area.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,3 @@
1717

1818
/* For folding/hiding paragraphs. It's applied to TextFlow. */
1919
.collapse { visibility: collapse; }
20-
21-
/* For LineNumberFactory, it's applied to Label. */
22-
.fold-indicator {
23-
-fx-font-weight: bold;
24-
-fx-text-fill: blue;
25-
}

0 commit comments

Comments
 (0)