Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/expected_type.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/struct_name_as_context.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 21 additions & 4 deletions src/renderer/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ fn render_snippet_annotations(
// the code in this line.
for (depth, style) in &multilines {
for line in previous_buffer_line..buffer.num_lines() {
draw_multiline_line(renderer, buffer, line, width_offset, *depth, *style);
draw_multiline_line(renderer, buffer, line, width_offset, *depth, *style, false);
}
}
// check to see if we need to print out or elide lines that come between
Expand All @@ -740,6 +740,7 @@ fn render_snippet_annotations(
width_offset,
*depth,
*style,
true,
);
}
if let Some(line) = annotated_lines.get(annotated_line_idx) {
Expand All @@ -759,6 +760,7 @@ fn render_snippet_annotations(
} else {
ElementStyle::UnderlineSecondary
},
true,
);
}
}
Expand Down Expand Up @@ -792,6 +794,7 @@ fn render_snippet_annotations(
width_offset,
*depth,
*style,
false,
);
}
if let Some(line) = annotated_lines.get(annotated_line_idx) {
Expand All @@ -808,6 +811,7 @@ fn render_snippet_annotations(
} else {
ElementStyle::UnderlineSecondary
},
false,
);
}
}
Expand Down Expand Up @@ -2078,12 +2082,25 @@ fn draw_multiline_line(
offset: usize,
depth: usize,
style: ElementStyle,
elided: bool,
) {
let chr = match (style, renderer.decor_style) {
(ElementStyle::UnderlinePrimary | ElementStyle::LabelPrimary, DecorStyle::Ascii) => '|',
(_, DecorStyle::Ascii) => '|',
(ElementStyle::UnderlinePrimary | ElementStyle::LabelPrimary, DecorStyle::Unicode) => '┃',
(_, DecorStyle::Unicode) => '│',
(ElementStyle::UnderlinePrimary | ElementStyle::LabelPrimary, DecorStyle::Unicode) => {
if elided {
'┇'
} else {
'┃'
}
}
(_, DecorStyle::Unicode) => {
if elided {
'┆'
} else {
'│'
}
}
};
buffer.putc(line, offset + depth - 1, chr, style);
}
Expand Down Expand Up @@ -2203,7 +2220,7 @@ fn draw_note_separator(
fn draw_line_separator(renderer: &Renderer, buffer: &mut StyledBuffer, line: usize, col: usize) {
let (column, dots) = match renderer.decor_style {
DecorStyle::Ascii => (0, "..."),
DecorStyle::Unicode => (col - 2, ""),
DecorStyle::Unicode => (col - 2, ""),
};
buffer.puts(line, column, dots, ElementStyle::LineNumber);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/color/fold_ann_multiline.unicode.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/color/highlight_source.unicode.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/color/issue_9.unicode.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/color/multiple_highlight_duplicated.unicode.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions tests/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,7 @@ error[E0599]: no method named `pick` found for struct `Chaenomeles` in the curre
╭▸
3 │ pub struct Chaenomeles;
│ ────────────────────── method `pick` not found for this struct
18 │ banana::Chaenomeles.pick()
│ ━━━━ method not found in `Chaenomeles`
╰╴
Expand Down Expand Up @@ -2491,7 +2491,7 @@ error[E0271]: type mismatch resolving `<Result<Result<(), Result<Result<(), Resu
21 │ ┃ Ok::<_, ()>(
22 │ ┃ Err::<(), _>(
23 │ ┃ Ok::<_, ()>(
‡ ┃
┆ ┇
32 │ ┃ )
│ ┗━━━━━┛ type mismatch resolving `<Result<Result<(), Result<Result<(), ...>, ...>>, ...> as Future>::Error == Foo`
╰╴
Expand Down Expand Up @@ -2602,7 +2602,7 @@ error[E0271]: type mismatch resolving `<Result<Result<(), Result<Result<(), Resu
21 │ ┃ Ok::<_, ()>(
22 │ ┃ Err::<(), _>(
23 │ ┃ Ok::<_, ()>(
‡ ┃
┆ ┇
32 │ ┃ )
│ ┗━━━━━┛ type mismatch resolving `<Result<Result<(), Result<Result<(), ...>, ...>>, ...> as Future>::Error == Foo`
╰╴
Expand Down Expand Up @@ -2785,7 +2785,7 @@ error[E0308]: mismatched types
25 │ │ Btype<
26 │ │ Ctype<
27 │ │ Atype<
‡ │
┆ ┆
47 │ │ i32
48 │ │ > = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O…
│ │┏━━━━━│━━━┛
Expand Down Expand Up @@ -4309,7 +4309,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
╭▸
12 │ cargo
│ ━━━━━
18 │ zappy
╰╴
"#]];
Expand Down Expand Up @@ -4800,7 +4800,7 @@ error: consider adding a `;` to the last statement for consistent formatting
5 │ ┃ if *x > 0 {
6 │ ┃ println!("Positive number");
7 │ ┃ } else {
‡ ┃
┆ ┇
10 │ ┃ })
│ ┗━━━━━━┛
╰╴
Expand Down
24 changes: 12 additions & 12 deletions tests/rustc_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ error: foo
2 │ fn foo() {
│ ┏━━━━━━━━━━┛
‡ ┃
┆ ┇
5 │ ┃ }
╰╴┗━━━┛ test
"#]];
Expand Down Expand Up @@ -1029,7 +1029,7 @@ error: foo
5 │ │ 1
6 │ │ 2
7 │ │ 3
‡ │
┆ ┆
15 │ │ X2 Y2 Z2
16 │ │ X3 Y3 Z3
╰╴ └──────────┘ `Y` is a good letter too
Expand Down Expand Up @@ -1113,7 +1113,7 @@ error: foo
10 │ ┃│ 6
11 │ ┃│ X2 Y2 Z2
│ ┃└──────────┘ `Z` is a good letter too
‡ ┃
┆ ┇
15 │ ┃ 10
16 │ ┃ X3 Y3 Z3
╰╴┗━━━━━━━━┛ `Y` is a good letter
Expand Down Expand Up @@ -1512,7 +1512,7 @@ note: required by a bound in `is_transmutable`
13 │ ┃ Assume {
14 │ ┃ alignment: true,
15 │ ┃ lifetimes: true,
‡ ┃
┆ ┇
19 │ ┃ }>
╰╴┗━━━━━━━━━━┛ required by this bound in `is_transmutable`
"#]];
Expand Down Expand Up @@ -1806,7 +1806,7 @@ warning: non-local `macro_rules!` definition, `#[macro_export]` macro should be
4 │ macro_rules! outer_macro {
│ ──────────────────────── in this expansion of `nested_macro_rules::outer_macro!`
7 │ ┏ macro_rules! inner_macro {
8 │ ┃ ($bang_macro:ident, $attr_macro:ident) => {
9 │ ┃ $bang_macro!($name);
Expand Down Expand Up @@ -2696,7 +2696,7 @@ error: unclosed frontmatter
╭▸ $DIR/unclosed-1.rs:1:1
1 │ ┏ ----cargo
‡ ┃
┆ ┇
7 │ ┃
│ ┗━┛
╰╴
Expand Down Expand Up @@ -2769,7 +2769,7 @@ error: unclosed frontmatter
╭▸ $DIR/unclosed-2.rs:1:1
1 │ ┏ ----cargo
‡ ┃
┆ ┇
14 │ ┃ "----"
15 │ ┃ }
│ ┗━━┛
Expand Down Expand Up @@ -2975,7 +2975,7 @@ error: unclosed frontmatter
╭▸ $DIR/unclosed-5.rs:1:1
1 │ ┏ ----cargo
‡ ┃
┆ ┇
7 │ ┃
│ ┗━┛
╰╴
Expand Down Expand Up @@ -4166,7 +4166,7 @@ error[E0599]: the method `quote_into_iter` exists for struct `Ipv4Addr`, but its
7 │ struct Ipv4Addr;
│ ─────────────── method `quote_into_iter` not found for this struct because it doesn't satisfy `Ipv4Addr: Iterator`, `Ipv4Addr: ToTokens`, `Ipv4Addr: proc_macro::ext::RepIteratorExt` or `Ipv4Addr: proc_macro::ext::RepToTokensExt`
11 │ let _ = quote! { $($ip)* }; //~ ERROR the method `quote_into_iter` exists for struct `Ipv4Addr`, but its trait bounds were not sat…
│ ━━━━━━━━━━━━━━━━━━ method cannot be called on `Ipv4Addr` due to unsatisfied trait bounds
Expand Down Expand Up @@ -4265,7 +4265,7 @@ error[E0220]: associated type `Pr` not found for `S<bool>` in the current scope
12 │ struct S<T>(T);
│ ─────────── associated type `Pr` not found for this struct
28 │ let _: S::<bool>::Pr = ();
│ ━━ associated item not found in `S<bool>`
Expand Down Expand Up @@ -5499,7 +5499,7 @@ error[E0599]: no method named `bar` found for struct `Thing` in the current scop
1 │ struct Thing {
│ ──────────── method `bar` not found for this struct
25 │ t.bar();
│ ━━━ method not found in `Thing`
╰╴
Expand Down Expand Up @@ -5801,7 +5801,7 @@ error[E0061]: this function takes 1 argument but 3 arguments were supplied
2 │ String::with_capacity(
│ ━━━━━━━━━━━━━━━━━━━━━
5 │ ┌ r#"
6 │ │ pub(crate) struct Person<T: Clone> {}
7 │ │ "#,
Expand Down
Loading