Open
Description
Hello, thanks for your amazing work on this crate!
I recently encountered a problem while trying to annotate Unix line feeds (\n
). When annotating line feeds with an empty Range
, I got the following error:
error: bad
--> test.txt:1:1
|
|
This looks like a bug because doing the same thing on letters or digits works as expected:
error: bad
--> test.txt:1:1
|
1 | 111
| ^
|
Also, giving a non-empty Range
solves the problem and outputs the annotation as expected:
error: bad
--> test.txt:1:1
|
1 | ...
| ^
|
Here is the code used to reproduce the problem (which occurs with the latest release). test.txt
is a simple text file containing only Unix line feeds (\n
):
use annotate_snippets::{Level, Renderer, Snippet};
pub fn reproduce_bug() {
let renderer = Renderer::styled();
let message = Level::Error.title("bad").snippet(
Snippet::source(include_str!("../test.txt"))
.origin("test.txt")
.fold(true)
.annotation(Level::Error.span(0..0)),
);
anstream::println!("{}", renderer.render(message));
}
Metadata
Metadata
Assignees
Labels
No labels