diff options
author | Fenzland <fenzland@163.com> | 2020-05-02 01:03:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-01 13:03:54 -0400 |
commit | 25b765c123ee4779d223b10adbea8db5c472d5a0 (patch) | |
tree | c60b73066c4edf806087f04cb64331349042367b /core/js_errors.rs | |
parent | fa396c0a22f1de4a55ca3ad918f1ba4566d2575b (diff) |
fix misaligned error reporting on tab char (#5032)
Diffstat (limited to 'core/js_errors.rs')
-rw-r--r-- | core/js_errors.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/js_errors.rs b/core/js_errors.rs index 0e3f8cb91..dfad7238e 100644 --- a/core/js_errors.rs +++ b/core/js_errors.rs @@ -274,11 +274,14 @@ impl fmt::Display for JSError { write!(f, "{}", source_loc)?; } if self.source_line.is_some() { - write!(f, "\n{}\n", self.source_line.as_ref().unwrap())?; + let source_line = self.source_line.as_ref().unwrap(); + write!(f, "\n{}\n", source_line)?; let mut s = String::new(); for i in 0..self.end_column.unwrap() { if i >= self.start_column.unwrap() { s.push('^'); + } else if source_line.chars().nth(i as usize).unwrap() == '\t' { + s.push('\t'); } else { s.push(' '); } |