RichTextArea control and the StyledTextModel fail to handle end position for applyStyle() and replaceText() with the end position beyond the end of document, when the model is undoable.
The code in question should clamp the end position to avoid the internals requesting non-existing paragraphs from the mode.
Test cases (to be added to RichTextAreaTest):
@Test
public void applyStyleBeyondDocumentEnd() {
control.applyStyle(TextPos.ZERO, TextPos.ofLeading(100, 3), BOLD);
}
@Test
public void replaceTextBeyondDocumentEnd() {
control.appendText("1\n");
control.replaceText(TextPos.ofLeading(0, 1), TextPos.ofLeading(33, 3), "-");
assertEquals("1-", text());
}
The code in question should clamp the end position to avoid the internals requesting non-existing paragraphs from the mode.
Test cases (to be added to RichTextAreaTest):
@Test
public void applyStyleBeyondDocumentEnd() {
control.applyStyle(TextPos.ZERO, TextPos.ofLeading(100, 3), BOLD);
}
@Test
public void replaceTextBeyondDocumentEnd() {
control.appendText("1\n");
control.replaceText(TextPos.ofLeading(0, 1), TextPos.ofLeading(33, 3), "-");
assertEquals("1-", text());
}
- relates to
-
JDK-8351982 ☂ RichTextArea (Incubator) Feedback and Bugs in jfx24
-
- Open
-
- links to
-
Review(master)
openjdk/jfx/2001