widen CLI parse error code fragment displayed

fixes #2030
This commit is contained in:
alexlamsl 2017-05-31 01:21:48 +08:00
parent 4e0a22e5c8
commit 05a2fa27a3

View File

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