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

Incorrect result of GenericStyledArea.getStyleRangeAtPosition(int position) in 0.8.* #711

Closed
kelgon opened this issue Mar 29, 2018 · 4 comments
Labels

Comments

@kelgon
Copy link

kelgon commented Mar 29, 2018

I encountered some incorrect behavior of GenericStyledArea.getStyleRangeAtPosition(int position) in version 0.8.*

Here goes the detail:

InlineCssTextArea area = new InlineCssTextArea();
area.appendText("1234567890");
area.setStyle(5, 7, "-fx-fill:red;");
System.out.println(area.getStyleRangeAtPosition(6)); //expect '5,7' but print '0,5'
System.out.println(area.getStyleRangeAtPosition(8)); //expect '7,10' but print '0,5'

If I switch to version 0.7-M5, the result meets my expectation, which is '5,7' and '7,10'. But with 0.8.0, 0.8.1 or 0.8.2, the result is wrong.

@JordanMartinez
Copy link
Contributor

Just a quick guess, but I think the wrong TwoPosition.Bias value is being used somewhere (e.g. BACKWARDS instead of FORWARDS).

I'll have to look into it more later on.

@JordanMartinez
Copy link
Contributor

Turns out the paragraph list's navigator, not the style spans' navigator, is being used to calculate the position within the StyleSpans object.

@JordanMartinez
Copy link
Contributor

Thanks for reporting that!

@JordanMartinez
Copy link
Contributor

I've released a new snapshot that includes the fix for you.

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