Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a0e10a8

Browse files
Merge pull request #42 from digama0/patch-1
fix off by one error in multiline highlighting
2 parents 46c5588 + 34df93e commit a0e10a8

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

‎src/display_list/from_snippet.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,10 @@ fn format_body(
427427
});
428428
}
429429

430+
let end_mark = (end - line_start).saturating_sub(1);
430431
let range = (
431-
(end - line_start) - margin_left,
432-
(end - line_start + 1) - margin_left,
432+
end_mark - margin_left,
433+
(end_mark + 1) - margin_left,
433434
);
434435
body.insert(
435436
body_idx + 1,

‎tests/fixtures/no-color/multiline_annotation.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ range = [5, 19]
3333
[[slices.annotations]]
3434
label = "expected enum `std::option::Option`, found ()"
3535
annotation_type = "Error"
36-
range = [22, 765]
36+
range = [22, 766]
3737
[title]
3838
label = "mismatched types"
3939
id = "E0308"

‎tests/fixtures/no-color/multiline_annotation2.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fold = false
1010
[[slices.annotations]]
1111
label = "missing fields `lineno`, `content`"
1212
annotation_type = "Error"
13-
range = [31, 127]
13+
range = [31, 128]
1414

1515
[title]
1616
label = "pattern does not mention fields `lineno`, `content`"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /