Skip to content

line number column has inconsistent width when starting line is set to 0 #183

New issue

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

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

Already on GitHub? # to your account

Closed
Pyr0de opened this issue Mar 17, 2025 · 1 comment
Closed
Labels
C-bug Category: bug

Comments

@Pyr0de
Copy link

Pyr0de commented Mar 17, 2025

For this code,

use annotate_snippets::{Level, Renderer, Snippet};

fn main() {
    let message =
        Level::Error
            .title("mismatched types")
            .snippet(
                Snippet::source("abcd")
                    .line_start(0)
            );

    let renderer = Renderer::styled();
    anstream::println!("{}", renderer.render(message));
}

Output

error: mismatched types
 |
0 |abcd

Output for when starting line is not 0

error: mismatched types
  |
1 | abcd

I would like to try to solve this issue if it needs to be fixed

@epage epage added the C-bug Category: bug label Mar 17, 2025
@epage
Copy link
Contributor

epage commented Mar 17, 2025

I believe this is a duplicate of #57 and closing in favor of that. If there is a reason for us to keep this open separately, let us know!

@epage epage closed this as completed Mar 17, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants