HighlightTextArea x-scroll hide the text
fgnm opened this issue · 4 comments
Please sorry for my issues, but this time I really can't figure out what's going wrong with HighlightTextArea
. Basically when you setText
or paste a long text (so that x scroll happens), all the text that is not initial visibile will be always hidden and not rendered anymore. But if you start typing something then it appears correctly. I've tried multiple workarounds (disable culling area, force a keyTyped
event, invalidate, and any other public method exposed) but nothing seems to work.
This is a GIF to better understand the situation:
Again, I cannot reproduce it with Test Application.. I've copied exactly the same example but in my enviroment produce this bug.. If you could give me an hint of why this bug may happens will be very helpful. Thanks!
No idea honestly. Is this only related to HighlightTextArea
? Try with ScrollableTextArea
, VisTextArea
, TextArea
. It could be issue with your layout, ScrollableTextArea#createCompatibleScrollPane
has some requirements listed in the docs. Try to create as small as possible public project to reproduce this, otherwise there's no way to debug it.
Sorry for delay, but I've finally figured out a way to reproduce the bug! You can use Test Application as well. The problem happens when styleName
parameter is provided to HighlightTextArea
.
If you create new HighlightTextArea("", "textArea")
the bug happens, while with new HighlightTextArea("")
the bug disappear. So, I've thought that the problem might be here:
I didn't understand what is softwrap
, but it is set to false
only in the first constructor, maybe should be set false
also for the others.. please let me know what do you thing about.
Yes, this is it. As per comment in ScrollableTextArea
:
* Warning: By default this can only support vertical scrolling. Scrolling in X direction MUST be disabled. It is NOT possible
* to use vertical scrolling without child class properly implementing {@link #getPrefWidth()} and disabling soft wraps.
* Example of such class is {@link HighlightTextArea}.
I'll add it.
Thanks for figuring it out!