widen CLI parse error code fragment displayed (#2032)

fixes #2030
This commit is contained in:
Alex Lam S.L
2017-05-31 01:56:52 +08:00
committed by GitHub
parent 4e0a22e5c8
commit 55b5f2a8aa

View File

@@ -225,9 +225,10 @@ function run() {
col = line.length;
}
if (line) {
if (col > 40) {
line = line.slice(col - 40);
col = 40;
var limit = 78;
if (col > limit) {
line = line.slice(col - limit);
col = limit;
}
console.error(line.slice(0, 80));
console.error(line.slice(0, col).replace(/\S/g, " ") + "^");