Skip to content
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

Labels without messages still create extra vertical space #51

Closed
kaikalii opened this issue Nov 24, 2022 · 3 comments · Fixed by #82
Closed

Labels without messages still create extra vertical space #51

kaikalii opened this issue Nov 24, 2022 · 3 comments · Fixed by #82
Labels
bug Something isn't working

Comments

@kaikalii
Copy link

Consider this example:

use ariadne::*;

const TEXT: &str = "a b c d";

fn report_n_labels(n: usize) {
    let mut report = Report::build(ReportKind::Error, (), 0);
    for i in 0..n {
        report = report.with_label(Label::new(i * 2..i * 2 + 1));
    }
    report.finish().print(Source::from(TEXT)).unwrap();
}

fn main() {
    for n in 1..=4 {
        report_n_labels(n);
    }
}

This gives output:

Error: 
   ╭─[<unknown>:1:1]
   │
 1 │ a b c d
   · ─
   ·
───╯
Error:
   ╭─[<unknown>:1:1]
   │
 1 │ a b c d
   · ─ ─
   ·
   ·
   ·
───╯
Error:
   ╭─[<unknown>:1:1]
   │
 1 │ a b c d
   · ─ ─ ─
   ·
   ·
   ·
   ·
   ·
───╯
Error:
   ╭─[<unknown>:1:1]
   │
 1 │ a b c d
   · ─ ─ ─ ─
   ·
   ·
   ·
   ·
   ·
   ·
   ·
───╯

It looks like labels add extra vertical space for their messages even if they don't have messages.
This occurs with compact mode too.
I think this is undesirable.

@zesterer
Copy link
Owner

Yes, this is undesirable. I'll make sure to fix this for the refactor.

@zesterer zesterer added the bug Something isn't working label Nov 25, 2022
@Override-6
Copy link
Contributor

I think i've fixed it in my fork
image
image

@zesterer
Copy link
Owner

This is now resolved, thanks @Override-6!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants