rustc: Fix position of diagnostic highlight lines
Diagnostic highlight lines are incorrect placed when the related line number is 10, 100, etc. The root cause is line number are treated as 0 based (should be 1 based) when calculating offset of line number digits.
This commit is contained in:
parent
8746ebe2e6
commit
2253ed5d1c
@ -193,7 +193,7 @@ fn maybe_highlight_lines(sp: option::t<span>, cm: codemap,
|
||||
if vec::len(lines.lines) == 1u {
|
||||
let lo = lookup_char_pos(cm, option::get(sp).lo);
|
||||
let digits = 0u;
|
||||
let num = lines.lines[0] / 10u;
|
||||
let num = (lines.lines[0] + 1u) / 10u;
|
||||
|
||||
// how many digits must be indent past?
|
||||
while num > 0u { num /= 10u; digits += 1u; }
|
||||
|
Loading…
Reference in New Issue
Block a user