Skip to content

Commit 936e982

Browse files
committed
fix: Left align line numbers
1 parent 96a2d7c commit 936e982

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
lines changed

examples/multislice.svg

+1-1
Loading

src/renderer/display_list.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,10 @@ impl DisplaySet<'_> {
292292
} => {
293293
let lineno_color = stylesheet.line_no();
294294
if anonymized_line_numbers && lineno.is_some() {
295-
let num = format!("{ANONYMIZED_LINE_NUM:>lineno_width$}");
296-
buffer.puts(line_offset, 0, &num, *lineno_color);
295+
buffer.puts(line_offset, 0, ANONYMIZED_LINE_NUM, *lineno_color);
297296
} else {
298297
if let Some(n) = lineno {
299-
let num = format!("{n:>lineno_width$}");
298+
let num = format!("{n}");
300299
buffer.puts(line_offset, 0, &num, *lineno_color);
301300
}
302301
}

tests/fixtures/color/multiple_annotations.svg

+4-4
Loading

tests/formatter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ error
149149
|
150150
::: file2.rs
151151
|
152-
2 | This is slice 2
152+
2 | This is slice 2
153153
"#]];
154154
let renderer = Renderer::plain();
155155
assert_data_eq!(renderer.render(input).to_string(), expected);

tests/rustc_tests.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -686,13 +686,13 @@ fn foo() {
686686
error: foo
687687
--> test.rs:3:6
688688
|
689-
3 | X0 Y0 Z0
689+
3 | X0 Y0 Z0
690690
| _______^
691-
4 | | X1 Y1 Z1
691+
4 | | X1 Y1 Z1
692692
| | ____^____-
693693
| ||____|
694694
| | `X` is a good letter
695-
5 | | 1
695+
5 | | 1
696696
... |
697697
15 | | X2 Y2 Z2
698698
16 | | X3 Y3 Z3
@@ -738,15 +738,15 @@ fn foo() {
738738
error: foo
739739
--> test.rs:3:6
740740
|
741-
3 | X0 Y0 Z0
741+
3 | X0 Y0 Z0
742742
| _______^
743-
4 | | 1
744-
5 | | 2
745-
6 | | 3
746-
7 | | X1 Y1 Z1
743+
4 | | 1
744+
5 | | 2
745+
6 | | 3
746+
7 | | X1 Y1 Z1
747747
| | _________-
748-
8 | || 4
749-
9 | || 5
748+
8 | || 4
749+
9 | || 5
750750
10 | || 6
751751
11 | || X2 Y2 Z2
752752
| ||__________- `Z` is a good letter too

0 commit comments

Comments
 (0)