RichTextFX
RichTextFX copied to clipboard
Bug: text area removes selection on text append
This is my code:
public class JavaFxTest8 extends Application {
@Override
public void start(Stage primaryStage) {
var codeArea = new CodeArea("Some text is here.");
var button1 = new Button("Jmi");
codeArea.selectedTextProperty().addListener((ov, oldV, newV) -> System.err.println(newV.length()));
button1.setOnAction(e -> {
codeArea.appendText("Appended text");
});
Scene scene = new Scene(new VBox(codeArea, button1), 400, 200);
primaryStage.setScene(scene);
primaryStage.show();
codeArea.selectRange(0, 4);
}
public static void main(String[] args) {
launch(args);
}
}
If you click the button, then selection will be removed. I consider it is a bug because text appending have nothing with text selection. I tried to save selection and restore it after text appending but then I get two events in selectedTextProperty. So, one problem leads to another.