Skip to content

Commit

Permalink
fix(de): Cut off multi-line error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
mahkoh committed Mar 9, 2024
1 parent 8b6f77e commit 4cd1e24
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 4cd1e24

Please sign in to comment.