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
seText is InlineCssTextArea
Here I try to set the style by selecting the first line : seText.setStyle(seText.getCurrentParagraph(),seText.getSelection().getStart(),seText.getSelection().getEnd(),ControlColorPane.getSelectedColor()); System.out.println(seText.getSelection());
I get good results
Output : 0, 5
But when I select the second line ans try changing the color
Get Caused by: java.lang.IndexOutOfBoundsException: [6, 11) is not a valid range within [0, 5)
Output : 6, 11
and the style does not change either
The text was updated successfully, but these errors were encountered:
columnPositionStart and columnPositionEnd expect to be a value x that is 0 <= x <= area.getParagraphLength(paragraphIndex).
However, you're passing in seText.getSelection().getStart() and seText.getSelection().getEnd(). This issue does not occur in the first example because the selection just happens to be the same values as the one you need (i.e. the start position is 0 and the end position is equal to the paragraph length). However, once you add another line, that is no longer the case. Your start position is in terms of the area's position, not the paragraph's position.
You should just use area.setStyle(getSelection().getStart(), getSelection().getEnd(), style)
seText
isInlineCssTextArea
Here I try to set the style by selecting the first line :
seText.setStyle(seText.getCurrentParagraph(),seText.getSelection().getStart(),seText.getSelection().getEnd(),ControlColorPane.getSelectedColor());
System.out.println(seText.getSelection());
I get good results
Output : 0, 5
But when I select the second line ans try changing the color
Get
Caused by: java.lang.IndexOutOfBoundsException: [6, 11) is not a valid range within [0, 5)
Output : 6, 11
and the style does not change either
The text was updated successfully, but these errors were encountered: