annotate-snippets-rs
annotate-snippets-rs copied to clipboard
Fix origin position computation
This PR fixes an issue in the computation of the position in the origin file. When a highlighted section starts at the beginning of the line, the origin position used to point to the end of the previous line, instead of the start of the current line. This resulted in outputs like this:
error: title
--> origin.txt:2:4
|
1 | aaa
2 | bbb
3 | ccc
| ^^^ annotation
4 | ddd
|
Here origin.txt:2:4 is wrong, it should be origin.txt:3:1, which actually matches the highlighted setting.
As a drive-by fix, 21645ad032dd9117d811db57a5740b6a6406f94a fixes EndLine, which was used incorrectly in multiple places that happened to cancel out.