- Notifications
You must be signed in to change notification settings - Fork48
Commit910bfef
committed
renderer: fix rendering of
This PR includes a small fix (that I am not at all sure about) and aregression test that fails on current master.The input here is just a single ASCII whitespace with an annotationpointing to immediately after that whitespace. In current master, itgets rendered like this:```error: missing trailing newline at end of file |1 | ... | ^ W292 | = help: Add trailing newline```But I think the insertion of an ellipsis here is not quite right. I wascertainly confused by the output.I don't really understand the formatting code at all, but I believe theellipsis is being inserted by this code:```rustif self.margin.was_cut_left() { // We have stripped some code/whitespace from the beginning, make it clear. buffer.puts(line_offset, code_offset, "...", *lineno_color);}```And `self.margin.was_cut_left()` was returning true because`computed_left` was set to `18446744073709551593`. This kind of value_seems_ like a bug, although some margin values are explicitlyinitialized to `usize::MAX`, so maybe not.Anywho, I tried removing the condition gating the setting of`whitespace_margin`, and that seems to fix this specific case withoutany other _known_ regressions (including across all of `ruff`'s testsuite), but this was mostly a result of me feeling around in the darkhere.source when it's a single ASCII whitespace1 parent7132bf3 commit910bfef
2 files changed
+27
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1400 | 1400 | | |
1401 | 1401 | | |
1402 | 1402 | | |
1403 | | - | |
1404 | | - | |
1405 | | - | |
| 1403 | + | |
1406 | 1404 | | |
1407 | 1405 | | |
1408 | 1406 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
955 | 955 | | |
956 | 956 | | |
957 | 957 | | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
0 commit comments
Comments
(0)