RichTextArea: exceptions specifying position beyond the document end

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: jfx25
    • Component/s: javafx
    • None
    • Fix Understood
    • generic

      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());
          }

            Assignee:
            Andy Goryachev
            Reporter:
            Andy Goryachev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: