Skip to content

New api #195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: Left align line numbers
  • Loading branch information
Muscraft committed Apr 16, 2025
commit 936e9823da77466bfd2f85b346a1cfd55777945a
2 changes: 1 addition & 1 deletion examples/multislice.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions src/renderer/display_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,10 @@ impl DisplaySet<'_> {
} => {
let lineno_color = stylesheet.line_no();
if anonymized_line_numbers && lineno.is_some() {
let num = format!("{ANONYMIZED_LINE_NUM:>lineno_width$}");
buffer.puts(line_offset, 0, &num, *lineno_color);
buffer.puts(line_offset, 0, ANONYMIZED_LINE_NUM, *lineno_color);
} else {
if let Some(n) = lineno {
let num = format!("{n:>lineno_width$}");
let num = format!("{n}");
buffer.puts(line_offset, 0, &num, *lineno_color);
}
}
Expand Down
8 changes: 4 additions & 4 deletions tests/fixtures/color/multiple_annotations.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ error
|
::: file2.rs
|
2 | This is slice 2
2 | This is slice 2
"#]];
let renderer = Renderer::plain();
assert_data_eq!(renderer.render(input).to_string(), expected);
Expand Down
20 changes: 10 additions & 10 deletions tests/rustc_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,13 +686,13 @@ fn foo() {
error: foo
--> test.rs:3:6
|
3 | X0 Y0 Z0
3 | X0 Y0 Z0
| _______^
4 | | X1 Y1 Z1
4 | | X1 Y1 Z1
| | ____^____-
| ||____|
| | `X` is a good letter
5 | | 1
5 | | 1
... |
15 | | X2 Y2 Z2
16 | | X3 Y3 Z3
Expand Down Expand Up @@ -738,15 +738,15 @@ fn foo() {
error: foo
--> test.rs:3:6
|
3 | X0 Y0 Z0
3 | X0 Y0 Z0
| _______^
4 | | 1
5 | | 2
6 | | 3
7 | | X1 Y1 Z1
4 | | 1
5 | | 2
6 | | 3
7 | | X1 Y1 Z1
| | _________-
8 | || 4
9 | || 5
8 | || 4
9 | || 5
10 | || 6
11 | || X2 Y2 Z2
| ||__________- `Z` is a good letter too
Expand Down