[debugger] call silent resume in debugEval to prevent incorrect cursor position after repl autocompletion, small refactor in readline

This commit is contained in:
Fedor Indutny 2011-09-09 03:05:21 +07:00
parent 01349bbd70
commit 8d7aade663
2 changed files with 7 additions and 6 deletions

View File

@ -687,10 +687,12 @@ Interface.prototype.pause = function() {
process.stdin.pause(); process.stdin.pause();
}; };
Interface.prototype.resume = function() { Interface.prototype.resume = function(silent) {
if (this.paused === 0 || --this.paused !== 0) return false; if (this.paused === 0 || --this.paused !== 0) return false;
this.repl.rli.resume(); this.repl.rli.resume();
if (silent !== true) {
this.repl.displayPrompt(); this.repl.displayPrompt();
}
process.stdin.resume(); process.stdin.resume();
if (this.waiting) { if (this.waiting) {
@ -752,13 +754,13 @@ Interface.prototype.debugEval = function(code, context, filename, callback) {
} else { } else {
callback(null); callback(null);
} }
self.resume(); self.resume(true);
return; return;
} }
client.mirrorObject(res.body, function(mirror) { client.mirrorObject(res.body, function(mirror) {
callback(null, mirror); callback(null, mirror);
self.resume(); self.resume(true);
}); });
}); });
}; };

View File

@ -265,7 +265,6 @@ Interface.prototype._tabComplete = function() {
// Apply/show completions. // Apply/show completions.
if (completions.length === 1) { if (completions.length === 1) {
self._insertString(completions[0].slice(completeOn.length)); self._insertString(completions[0].slice(completeOn.length));
self._refreshLine();
} else { } else {
self.output.write('\r\n'); self.output.write('\r\n');
var width = completions.reduce(function(a, b) { var width = completions.reduce(function(a, b) {
@ -317,8 +316,8 @@ Interface.prototype._tabComplete = function() {
self._insertString(prefix.slice(completeOn.length)); self._insertString(prefix.slice(completeOn.length));
} }
self._refreshLine();
} }
self._refreshLine();
} }
}); });
}; };