Closed
Description
I wrote a test to demonstrate this:
#[test]
fn lf_in_crlf() {
let source = "a\r\nb";
let input = Level::Error.title("").snippet(
Snippet::source(source)
.origin("file/path")
.line_start(3)
.annotation(Level::Error.span(2..3)), // \n
);
let expected = str![[r#"
error
--> file/path:1:1
|
3 | a
4 | | b
| |_^
|"#]]
.indent(false);
let renderer = Renderer::plain().anonymized_line_numbers(false);
assert_eq(expected, renderer.render(input).to_string());
}
This only happens when a span points to exactly the \n
byte that's preceded by \r
I believe this behavior is present since at least 0.10.0