Skip to content

Commit

Permalink
repl: eval empty lines, fixing debugger repeat
Browse files Browse the repository at this point in the history
Tweak the better empty line handling introduced in nodejs#2163 so that empty
lines are still passed to the eval function. This is required for the
debugger to repeat the last command on an empty line.

Fixes: nodejs#6010
  • Loading branch information
lrowe committed Apr 4, 2016
1 parent f739a12 commit 3d16617
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ function REPLServer(prompt,
}
}

if (!skipCatchall && (cmd || (!cmd && self.bufferedCommand))) {
if (!skipCatchall) {
var evalCmd = self.bufferedCommand + cmd;
if (/^\s*\{/.test(evalCmd) && /\}\s*$/.test(evalCmd)) {
// It's confusing for `{ a : 1 }` to be interpreted as a block
Expand Down Expand Up @@ -483,7 +483,7 @@ function REPLServer(prompt,
// immediately. We don't have to print anything else. So, only when
// the second argument to this function is there, print it.
arguments.length === 2 &&
(!self.ignoreUndefined || ret !== undefined)) {
(!(self.ignoreUndefined || evalCmd === '\n') || ret !== undefined)) {
if (!self.underscoreAssigned) {
self.last = ret;
}
Expand Down

0 comments on commit 3d16617

Please sign in to comment.