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

getLineNumber incorrect with Windows end of line separators #338

Closed
mattmook opened this issue Apr 16, 2019 · 3 comments
Closed

getLineNumber incorrect with Windows end of line separators #338

mattmook opened this issue Apr 16, 2019 · 3 comments

Comments

@mattmook
Copy link
Contributor

mattmook commented Apr 16, 2019

Document.getLineNumber assumes the end-of-line character is just one character wide and so on Windows Lin numbers are, effectively, doubled.

To Reproduce

Given the following we would expect the line number for the 7th character ('W') to return 1, however it returns 2:

Document document = new Document(new MutableDataSet(), BasedSequenceImpl.of("Hello\r\nWorld"));

document.getLineNumber(7) // should return 1

Additional context

I have created the PR #339 to fix this issue

@vsch
Copy link
Owner

vsch commented Apr 16, 2019

@mattmook, thank you for the PR and the report. I'll merge and release shortly.

@vsch
Copy link
Owner

vsch commented Apr 16, 2019

@mattmook, I only changed the code to not treat offset between \r\n as part of the next line. So only offsets after complete EOL reflect next line number.

Fix for this is available. Repo updated, maven updated but may take a while to show up in maven central.

@vsch vsch added this to the V 0.42.6 milestone Apr 16, 2019
@mattmook
Copy link
Contributor Author

Cool, many thanks

@vsch vsch closed this as completed Aug 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants