Skip to content

Multi-line slices are not wrapping around when over by 1 #16

Closed
@GodTamIt

Description

@GodTamIt

Given this code:

let snippet = Snippet {
    title: Some("failed to parse file".to_owned()),
    footer: vec![],
    slices: vec![Slice {
        source: r#"This is an example
content of the slice
which will be annotated
with the list of annotations below."#
            .to_string(),
        line_start: 26,
        origin: Some("chris.beep".to_owned()),
        fold: false,
        annotations: vec![SourceAnnotation {
            label: "hello world".to_owned(),
            annotation_type: AnnotationType::Error,
            range: (13, 20),
        }],
    }],
};

This results in the following output:

error: failed to parse file
  --> chris.beep:26:13
   |
26 | This is an example
   |              ^^^^^^^ hello world
27 | content of the slice
28 | which will be annotated
29 | with the list of annotations below.

I would expect the underlining should wrap around to include the c of content on the next line. If we change the range from (13, 20) to (13, 21), that result includes the co of content being underlined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions