From 4cc49c369eded9fa9841f2918fa31e5dafce2f48 Mon Sep 17 00:00:00 2001 From: Jurgen Date: Wed, 27 Jan 2021 13:33:11 +0200 Subject: [PATCH] Fix custom fold CSS not being applied (#1000) --- .../java/org/fxmisc/richtext/LineNumberFactory.java | 11 ++++++----- .../org/fxmisc/richtext/styled-text-area.css | 6 ------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/richtextfx/src/main/java/org/fxmisc/richtext/LineNumberFactory.java b/richtextfx/src/main/java/org/fxmisc/richtext/LineNumberFactory.java index b71491eb6..c282ffeda 100644 --- a/richtextfx/src/main/java/org/fxmisc/richtext/LineNumberFactory.java +++ b/richtextfx/src/main/java/org/fxmisc/richtext/LineNumberFactory.java @@ -17,6 +17,7 @@ import javafx.scene.paint.Paint; import javafx.scene.text.Font; import javafx.scene.text.FontPosture; +import javafx.scene.text.FontWeight; import org.reactfx.collection.LiveList; import org.reactfx.value.Val; @@ -29,10 +30,9 @@ public class LineNumberFactory implements IntFunction { private static final Insets DEFAULT_INSETS = new Insets(0.0, 5.0, 0.0, 5.0); private static final Paint DEFAULT_TEXT_FILL = Color.web("#666"); - private static final Font DEFAULT_FONT = - Font.font("monospace", FontPosture.ITALIC, 13); - private static final Background DEFAULT_BACKGROUND = - new Background(new BackgroundFill(Color.web("#ddd"), null, null)); + private static final Font DEFAULT_FONT = Font.font("monospace", FontPosture.ITALIC, 13); + private static final Font DEFAULT_FOLD_FONT = Font.font("monospace", FontWeight.BOLD, 13); + private static final Background DEFAULT_BACKGROUND = new Background(new BackgroundFill(Color.web("#ddd"), null, null)); public static IntFunction get(GenericStyledArea area) { return get(area, digits -> "%1$" + digits + "s"); @@ -113,7 +113,8 @@ public Node apply(int idx) { if ( isFoldedCheck != null ) { Label foldIndicator = new Label( " " ); - foldIndicator.setTextFill( DEFAULT_TEXT_FILL ); // Prevents CSS errors + foldIndicator.setTextFill( Color.BLUE ); // Prevents CSS errors + foldIndicator.setFont( DEFAULT_FOLD_FONT ); lineNo.setContentDisplay( ContentDisplay.RIGHT ); lineNo.setGraphic( foldIndicator ); diff --git a/richtextfx/src/main/resources/org/fxmisc/richtext/styled-text-area.css b/richtextfx/src/main/resources/org/fxmisc/richtext/styled-text-area.css index 088ac9025..afb0e5f87 100644 --- a/richtextfx/src/main/resources/org/fxmisc/richtext/styled-text-area.css +++ b/richtextfx/src/main/resources/org/fxmisc/richtext/styled-text-area.css @@ -17,9 +17,3 @@ /* For folding/hiding paragraphs. It's applied to TextFlow. */ .collapse { visibility: collapse; } - -/* For LineNumberFactory, it's applied to Label. */ -.fold-indicator { - -fx-font-weight: bold; - -fx-text-fill: blue; -}