Skip to content

Commit

Permalink
Merge pull request #699 from mahkoh/jorth/error-column
Browse files Browse the repository at this point in the history
fix(de): cut off multi-line error messages at the end of the first line
  • Loading branch information
epage authored Mar 11, 2024
2 parents 523969d + 4cd1e24 commit 01d2f4a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/toml/tests/testsuite/de_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ unknown field `c_d`, expected `c_a` or `c_b`
TOML parse error at line 6, column 13
|
6 | [[p_b]]
| ^^^^^^^^^^^^^^^^^^^
| ^^^^^^^
missing field `c_b`
"
);
Expand Down
2 changes: 1 addition & 1 deletion crates/toml_edit/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl Display for TomlError {
// The span will be empty at eof, so we need to make sure we always print at least
// one `^`
write!(f, "^")?;
for _ in (span.start + 1)..(span.end.min(span.start + content.len())) {
for _ in (span.start + 1)..(span.end.min(span.start + content.len() - column)) {
write!(f, "^")?;
}
writeln!(f)?;
Expand Down

0 comments on commit 01d2f4a

Please sign in to comment.