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:
Haitao Li 2011-11-24 14:58:38 +08:00 committed by Marijn Haverbeke
parent 8746ebe2e6
commit 2253ed5d1c
1 changed files with 1 additions and 1 deletions

View File

@ -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; }