annotate-snippets-rs
annotate-snippets-rs copied to clipboard
fix: Remove false positive line trimming
Previously, it was possible for a ... to be inserted when no trimming
was actually done. For example:
|
1 | version = "0.1.0"
2 | # Ensure that the spans from toml handle utf-8 correctly
3 | authors = [
| ___________^
4 | | { name = "Z...ALGO", email = 1 }
5 | | ]
| |_^ RUF200
|
After this fix, the ... is no longer inserted:
|
1 | version = "0.1.0"
2 | # Ensure that the spans from toml handle utf-8 correctly
3 | authors = [
| ___________^
4 | | { name = "ZALGO", email = 1 }
5 | | ]
| |_^ RUF200
|
This is another low confidence fix where I'm not sure that it's right. But the implementation was previously seeming to conflate the line length (in bytes) versus the actual rendered length. So instead of trying to do some math to figure out whether an ellipsis should be inserted, we just keep track of whether the code line we write was truncated or not.