From 08bf133805c2069e0b2e00d3df5fa22525432162 Mon Sep 17 00:00:00 2001 From: Nathan Zadoks Date: Sat, 25 Jul 2015 02:30:07 -0400 Subject: [PATCH] don't strip spaces for regular REPL input This means ` .method()` isn't misparsed as a REPL keyword, and significantly improves the usability of `.load`. --- lib/repl.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/repl.js b/lib/repl.js index 1d78a001953bf6..666b3df1ffe794 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -329,10 +329,7 @@ function REPLServer(prompt, self._currentStringLiteral = parseLine(cmd, self._currentStringLiteral); const isWithinStrLiteral = self._currentStringLiteral !== null; - if (!wasWithinStrLiteral && !isWithinStrLiteral) { - // Current line has nothing to do with String literals, trim both ends - cmd = cmd.trim(); - } else if (wasWithinStrLiteral && !isWithinStrLiteral) { + if (wasWithinStrLiteral && !isWithinStrLiteral) { // was part of a string literal, but it is over now, trim only the end cmd = cmd.trimRight(); } else if (isWithinStrLiteral && !wasWithinStrLiteral) {