8000 Change multiline rendering with breaks to work properly by mbartlett21 · Pull Request #330 · brendanzab/codespan · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Change multiline rendering with breaks to work properly #330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 8, 2021
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
50 changes: 50 additions & 0 deletions codespan-reporting/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,56 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Broken lines are now rendered properly with multiline spans.

We used to render the wrong lines in the gutter when there were multiline spans
and there were breaks in the file.

<details>
<summary>Example</summary>

Before:

```text
error[0001]: oh noes, a cupcake has occurred!
┌─ test:4:1
4 │ ╭ Cupcake ipsum dolor. Sit amet marshmallow topping cheesecake
5 │ │ muffin. Halvah croissant candy canes bonbon candy. Apple pie jelly
│ ╭─│─────────'
· │
10 │ │ │ Muffin danish chocolate soufflé pastry icing bonbon oat cake.
11 │ │ │ Powder cake jujubes oat cake. Lemon drops tootsie roll marshmallow
│ │ ╰─────────────────────────────' blah blah
· │ │
19 │ │ soufflé marzipan. Chocolate bar oat cake jujubes lollipop pastry
20 │ │ cupcake. Candy canes cupcake toffee gingerbread candy canes muffin
│ ╰──────────' blah blah
```

After:

```text
error[0001]: oh noes, a cupcake has occurred!
┌─ test:4:1
4 │ ╭ Cupcake ipsum dolor. Sit amet marshmallow topping cheesecake
5 │ │ muffin. Halvah croissant candy canes bonbon candy. Apple pie jelly
│ ╭─│─────────'
· │ │
10 │ │ │ Muffin danish chocolate soufflé pastry icing bonbon oat cake.
11 │ │ │ Powder cake jujubes oat cake. Lemon drops tootsie roll marshmallow
│ │ ╰─────────────────────────────' blah blah
· │
19 │ │ soufflé marzipan. Chocolate bar oat cake jujubes lollipop pastry
20 │ │ cupcake. Candy canes cupcake toffee gingerbread candy canes muffin
│ ╰──────────' blah blah
```

</details>

## [0.11.1] - 2021-01-18

### Added
Expand Down
4 changes: 2 additions & 2 deletions codespan-reporting/src/term/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ where

// Check to see if we need to render any intermediate stuff
// before rendering the next line.
if let Some((next_line_index, _)) = lines.peek() {
if let Some((next_line_index, next_line)) = lines.peek() {
match next_line_index.checked_sub(*line_index) {
// Consecutive lines
Some(1) => {}
Expand Down Expand Up @@ -361,7 +361,7 @@ where
outer_padding,
self.diagnostic.severity,
labeled_file.num_multi_labels,
&line.multi_labels,
&next_line.multi_labels,
)?;
}
}
Expand Down
0