Skip to content

Position of Caret and Selection are not updated correctly when change occurs at their current position #761

@SkyAphid

Description

@SkyAphid

If you type into a StyleClassedTextArea, then press CTRL-Z, then begin typing again, the cursor gets reset to the start of the text.

Code:

StyleClassedTextArea textArea = new StyleClassedTextArea();
textArea.replaceText(node.getText());
textArea.setStyle("-fx-font-family: '" + textFont.getFamily() + "'; -fx-font-size: " + textFont.getSize());
textArea.setWrapText(true);
		
//Update body text
textArea.textProperty().addListener((o, oldText, newText) -> {
snip
});
		
VirtualizedScrollPane<StyleClassedTextArea> scrollPane = new VirtualizedScrollPane<StyleClassedTextArea>(textArea);
		
StackPane.setAlignment(scrollPane, Pos.CENTER);
StackPane.setMargin(scrollPane, new Insets(START_BODY_Y, 20, 20, 20));
		
getChildren().add(scrollPane);

Also, if there's no way to fix this, is there a way to just disable CTRL-Z entirely?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions