Crash when trying to select in VisTextArea when libGDX color marckup is enabled
Closed this issue · 3 comments
VisTextArea
and all its children (HighlightTextArea
, ScrollableTextArea
), crashes when color markup is enabled.
Stacktrace:
java.lang.IndexOutOfBoundsException: index can't be >= size: 1299 >= 1291
at com.badlogic.gdx.utils.FloatArray.get(FloatArray.java:131)
at com.kotcrab.vis.ui.widget.VisTextArea.drawSelection(VisTextArea.java:251)
at com.kotcrab.vis.ui.widget.VisTextField.draw(VisTextField.java:350)
at com.badlogic.gdx.scenes.scene2d.Group.drawChildren(Group.java:111)
at com.badlogic.gdx.scenes.scene2d.ui.ScrollPane.draw(ScrollPane.java:543)
at com.badlogic.gdx.scenes.scene2d.Group.drawChildren(Group.java:124)
at com.badlogic.gdx.scenes.scene2d.Group.draw(Group.java:58)
at com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.draw(WidgetGroup.java:170)
at com.badlogic.gdx.scenes.scene2d.ui.Table.draw(Table.java:126)
at com.badlogic.gdx.scenes.scene2d.Group.drawChildren(Group.java:111)
at com.badlogic.gdx.scenes.scene2d.ui.Table.draw(Table.java:117)
at com.badlogic.gdx.scenes.scene2d.ui.Window.draw(Window.java:253)
at com.kotcrab.vis.ui.widget.VisWindow.draw(VisWindow.java:239)
at com.badlogic.gdx.scenes.scene2d.Group.drawChildren(Group.java:111)
at com.badlogic.gdx.scenes.scene2d.Group.draw(Group.java:58)
at com.badlogic.gdx.scenes.scene2d.Stage.draw(Stage.java:129)
I think that start
and end
are not aware that markup glyphs are not rendered, and so the range is higher then the size of glyphPositions
array
vis-ui/ui/src/main/java/com/kotcrab/vis/ui/widget/VisTextArea.java
Lines 247 to 248 in 8b997f2
Where could be the right place to fix this? Thanks
LibGDX and VisUI doesn't support color markup for any text field iirc, see #313.
Can you reproduce this with libgdx's TextArea
?
VisTextArea
is mostly a copy of TextArea
so something must have changed. I remember it working in TextArea
(or TextField
?) with issues.
I'm guessing fixing this requires parsing the text to remove color markup before it's used for selection and others functions. I'd nice if this was working in libGDX, I never wanted to change VisTextArea
too much.