Fixed an error formatting issue f7b36054fc

When using tab for code indent, the error marker
will be wrongly positioned.
This commit is contained in:
Yad Smood 2014-07-16 17:56:07 +08:00
parent f7b36054fc
commit 3465e7554d
2 changed files with 2 additions and 2 deletions

View File

@ -220,7 +220,7 @@
codeLine = this.code.split('\n')[first_line];
start = first_column;
end = first_line === last_line ? last_column + 1 : codeLine.length;
marker = repeat(' ', start) + repeat('^', end - start);
marker = codeLine.slice(0, start).replace(/[^\s]/g, ' ') + repeat('^', end - start);
if (typeof process !== "undefined" && process !== null) {
colorsEnabled = process.stdout.isTTY && !process.env.NODE_DISABLE_COLORS;
}

View File

@ -172,7 +172,7 @@ syntaxErrorToString = ->
start = first_column
# Show only the first line on multi-line errors.
end = if first_line is last_line then last_column + 1 else codeLine.length
marker = repeat(' ', start) + repeat('^', end - start)
marker = codeLine[...start].replace(/[^\s]/g, ' ') + repeat('^', end - start)
# Check to see if we're running on a color-enabled TTY.
if process?