Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HighlightTextArea x-scroll hide the text #339

Closed
fgnm opened this issue Aug 31, 2020 · 4 comments
Closed

HighlightTextArea x-scroll hide the text #339

fgnm opened this issue Aug 31, 2020 · 4 comments
Labels

Comments

@fgnm
Copy link
Contributor

fgnm commented Aug 31, 2020

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:
highlight-scroll-bug

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!

@kotcrab
Copy link
Owner

kotcrab commented Aug 31, 2020

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.

@kotcrab kotcrab added the ui label Aug 31, 2020
@fgnm
Copy link
Contributor Author

fgnm commented Sep 1, 2020

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:

public HighlightTextArea (String text) {
super(text);
softwrap = false;
}
public HighlightTextArea (String text, String styleName) {
super(text, styleName);
}
public HighlightTextArea (String text, VisTextFieldStyle style) {
super(text, style);
}

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.

@kotcrab
Copy link
Owner

kotcrab commented Sep 1, 2020

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.

@kotcrab kotcrab added the bug label Sep 1, 2020
@kotcrab kotcrab closed this as completed in ba66b23 Sep 1, 2020
@kotcrab
Copy link
Owner

kotcrab commented Sep 1, 2020

Thanks for figuring it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants