CodeArea: Exception in IME

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • jfx26
    • Affects Version/s: jfx26
    • Component/s: javafx
    • None
    • Cause Known

      The following test fails with

      java.lang.IndexOutOfBoundsException: index=3
      at jfx.incubator.richtext/jfx.incubator.scene.control.richtext.RichTextArea.getPlainText(RichTextArea.java:1494)
      at jfx.incubator.richtext/jfx.incubator.scene.control.richtext.RichTextArea.getText(RichTextArea.java:1552)
      at jfx.incubator.richtext/jfx.incubator.scene.control.richtext.RichTextArea$1.getText(RichTextArea.java:322)
      at jfx.incubator.richtext/com.sun.jfx.incubator.scene.control.richtext.RichTextAreaHelper.getText(RichTextAreaHelper.java:59)
      at jfx.incubator.richtext/test.jfx.incubator.scene.control.richtext.CodeAreaTest.selectAll(CodeAreaTest.java:327)
      at java.base/java.lang.reflect.Method.invoke(Method.java:565)
      at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
      at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)




      ```
          @Test
          public void selectAll() {
              String text =
                  """
                  Hello, Javafx1
                  Hello, Javafx2
                  """;
              control.setText(text);
              assertEquals(3, control.getParagraphCount());

              control.selectAll();
              SelectionSegment sel = control.getSelection();
              StringBuilder sb = new StringBuilder();
              RichTextAreaHelper.getText(control, sel.getMin(), sel.getMax(), sb, Integer.MAX_VALUE);
              assertEquals(text, sb.toString());
          }
      ```

      The same issue is present in RichTextArea.

      Thanks to https://github.com/oyzh1994 for discovering the bug and providing a test case: https://github.com/andy-goryachev-oracle/Test/issues/6#issuecomment-3726867016

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

              Created:
              Updated: