Fixes: https://github.com/zkat/miette/issues/336
BREAKING CHANGE: This bumps owo-colors to 4.0, which is a breaking change because we expose its styles as part of the graphical renderer API
The default `GraphicalReportHandler` disables the printing of cause
chains for any inner errors (errors `related()` to a source diagnostic)
when it disables nested footer printing. This results in lost cause
chain information when printing with the default report handler.
Previously, these tests would have spurious failures when NO_COLOR or
FORCE_COLOR was set in the user's environment, since we weren't clearing
one variable before testing a value for the other one. The previous
version of the code also did not restore environment variable values on
panic, which could cause spurious failures in other tests after one test
fails.
Fixes: https://github.com/zkat/miette/issues/317
It turned out there were two really. One related to how many characters
were added for the arrowheads in the gutter, and one where the gutter
was extended to a number of characters, including ansi escape codes.
However, because ansi escape codes are rather big, there would never be
any extension since the system thought the string was already long
enough, even though you don't actually see the width of those codes.
Previous output looked like this:
---- single_line_with_wide_char_unaligned_span_empty stdout ----
Error: oops::my::bad
× oops!
╭─[bad_file.rs:2:4]
1 │ source
2 │ 👼🏼text
· ─▲
· ╰── this bit here
3 │ here
╰────
help: try doing it better next time?
Note that the .max(start + 1) term is still necessary in the nonempty
branch, since it's possible to have a nonempty span covering zero-width
text.
* remove uncessary if statement
start > end in all cases.
Fixes: https://github.com/zkat/miette/issues/223
This fixes a panic when an error starts inside a Unicode code point. The
range is extended to start (or end) at the beginning (or end) of the
character inside which the byte offset is located.
An example in README.md makes use of `miette::NamedResult` .
It is imported in the second "example-step", but already used in the first one. Beginners, that copy the example step-by-step to understand it, will run into compile errors, as `NamedResult` was not imported.
* ci: Update actions, replace actions-rs.
* `actions/checkout` is updated from `v1` to the current `v4`.
* `actions-rs/toolchain` is replaced by `dtolnay/rust-toolchain` as
the `actions-rs` actions haven't been maintained in a long time.
* clippy: Remove unnecessary call to `into_iter`.
The parameter takes `IntoIterator`, so we don't have to call
`into_iter` at the call site.
* clippy: Remove explicit lifetime that can be elided.
* clippy: tests: Fix useless conversion warnings.
* clippy: tests: Remove call to `format!`.
* Fix minimal-versions build.
Due to changes in the nightly compiler, using a recent nightly
requires proc-macro2 1.0.60 or later:
https://github.com/dtolnay/proc-macro2/issues/356
* ci: Use is-terminal 0.4.7 for MSRV builds.
is-terminal 0.4.8 updated its MSRV to 1.63, so we can't use it
with our MSRV of 1.56. Force usage of the older version which has
an older MSRV.