From 3d66d0b008649c0f9a1cae68b58873230832d4a2 Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Fri, 1 Nov 2024 07:47:44 +1300 Subject: Fix minor formatting issue in error messages The padding for the line numbers in the left margin was being calculated from the length of the zero indexed line number, but the value being printed was the one-indexed line number, so the margin would be offset by a character when an error occurred on a one-indexed line number that was a power of ten. --- src/print.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/print.rs b/src/print.rs index b2c2ba8..800a1d5 100644 --- a/src/print.rs +++ b/src/print.rs @@ -163,8 +163,8 @@ fn print_source_issue(message: &str, context: Context, variant: SourceIssueVaria // Prepare variables. let location = &context.source.in_merged; - let digits = location.start.line.to_string().len(); let y = location.start.line + 1; + let digits = y.to_string().len(); let arrow = "-->"; let space = " "; -- cgit v1.2.3-70-g09d2