Skip to content

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

Duplicate of#57
@Pyr0de

Description

@Pyr0de

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

Activity

epage

epage commented on Mar 17, 2025

@epage
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @epage@Pyr0de

        Issue actions

          line number column has inconsistent width when starting line is set to 0 · Issue #183 · rust-lang/annotate-snippets-rs