Skip to content
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

fix(de): cut off multi-line error messages at the end of the first line #699

Merged
merged 1 commit into from
Mar 11, 2024
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
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
Loading