You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: end is greater than length: 108 > 78
at org.fxmisc.richtext.EditableStyledDocument.ensureValidRange(EditableStyledDocument.java:380)
at org.fxmisc.richtext.EditableStyledDocument.ensureValidRange(EditableStyledDocument.java:365)
at org.fxmisc.richtext.EditableStyledDocument.setStyle(EditableStyledDocument.java:189)
at org.fxmisc.richtext.StyledTextArea.setStyle(StyledTextArea.java:512)
Here is what is happening.
I save my content as an HTML file. which sometimes generated empty styles or styles ranges that are invalid. I think this is a result of working with the text area. When I save my text area content, I get the styles, and save where they start and end.
When reading my saved files, I fetch this information back and reconstruct the text by creating rich text area with plain text, then creating the styles, then applying the styles.
In this process, probably due to my not so robust code, some styles are fetched at zero start and end, etc.
The error says style end is greater than length. I assume it is saying the style being applied as an end range that is longer than the document.
to avoid this error I check if the end value is larger than the text length, and take the smaller of them.
I am reporting this I guess as a case which you might find important to address -- when people like me (doing bad code) use your awesome code! :D
Thanks,
Maher
The text was updated successfully, but these errors were encountered:
I don't understand what you are suggesting me to do. If you are trying to assign style beyond the length of the text, which is illegal, you get an IllegalArgumentException, which I find appropriate. What else should RichTextFX do?
Hi Tomas, What I am suggesting is to probably make RichTextFX automatically applies the smallest of style end value or text length. now that I think of it. Yes, it does make sense that it is done this way. Otherwise, one would not know what code is doing if it fixes things on its own.
Hi Tomas, I am running into this error sometimes:
Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: end is greater than length: 108 > 78
at org.fxmisc.richtext.EditableStyledDocument.ensureValidRange(EditableStyledDocument.java:380)
at org.fxmisc.richtext.EditableStyledDocument.ensureValidRange(EditableStyledDocument.java:365)
at org.fxmisc.richtext.EditableStyledDocument.setStyle(EditableStyledDocument.java:189)
at org.fxmisc.richtext.StyledTextArea.setStyle(StyledTextArea.java:512)
Here is what is happening.
I save my content as an HTML file. which sometimes generated empty styles or styles ranges that are invalid. I think this is a result of working with the text area. When I save my text area content, I get the styles, and save where they start and end.
When reading my saved files, I fetch this information back and reconstruct the text by creating rich text area with plain text, then creating the styles, then applying the styles.
In this process, probably due to my not so robust code, some styles are fetched at zero start and end, etc.
The error says style end is greater than length. I assume it is saying the style being applied as an end range that is longer than the document.
to avoid this error I check if the end value is larger than the text length, and take the smaller of them.
I am reporting this I guess as a case which you might find important to address -- when people like me (doing bad code) use your awesome code! :D
Thanks,
Maher
The text was updated successfully, but these errors were encountered: