better handle multiline errors

this is more of a quick fix for potential panics; it does not
properly substitute for real multiline error messages
This commit is contained in:
ConnorSkees 2020-05-24 12:19:08 -04:00
parent 35087fb266
commit 3c1c55038f
2 changed files with 2 additions and 1 deletions

View File

@ -66,7 +66,7 @@ impl Display for SassError {
"{}| {}{}",
padding,
vec![' '; loc.begin.column].iter().collect::<String>(),
vec!['^'; loc.end.column - loc.begin.column]
vec!['^'; loc.end.column.max(loc.begin.column) - loc.begin.column.min(loc.end.column)]
.iter()
.collect::<String>()
)?;

View File

@ -130,3 +130,4 @@ error!(unclosed_dbl_quote, "@if true \" {}", "Error: Expected \".");
error!(unclosed_sgl_quote, "@if true ' {}", "Error: Expected '.");
error!(unclosed_call_args, "@if a({}", "Error: expected \")\".");
error!(nothing_after_div, "@if a/", "Error: Expected expression.");
error!(multiline_error, "@if \"\n\"{}", "Error: Expected \".");