summaryrefslogtreecommitdiff
path: root/cli/fmt_errors.rs
diff options
context:
space:
mode:
authorFenzland <fenzland@163.com>2020-05-02 01:03:54 +0800
committerGitHub <noreply@github.com>2020-05-01 13:03:54 -0400
commit25b765c123ee4779d223b10adbea8db5c472d5a0 (patch)
treec60b73066c4edf806087f04cb64331349042367b /cli/fmt_errors.rs
parentfa396c0a22f1de4a55ca3ad918f1ba4566d2575b (diff)
fix misaligned error reporting on tab char (#5032)
Diffstat (limited to 'cli/fmt_errors.rs')
-rw-r--r--cli/fmt_errors.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/cli/fmt_errors.rs b/cli/fmt_errors.rs
index d2c69819f..e0fc61459 100644
--- a/cli/fmt_errors.rs
+++ b/cli/fmt_errors.rs
@@ -74,7 +74,11 @@ fn format_maybe_source_line(
'~'
};
for _i in 0..start_column {
- s.push(' ');
+ if source_line.chars().nth(_i as usize).unwrap() == '\t' {
+ s.push('\t');
+ } else {
+ s.push(' ');
+ }
}
for _i in 0..(end_column - start_column) {
s.push(underline_char);