* configurable via .prompt()'s preserveCursor argument (false by default)
}).map(function(chunk) {
return '< ' + chunk;
}).join('\n'));
- this.repl.displayPrompt();
+ this.repl.displayPrompt(true);
};
// Errors formatting
};
-Interface.prototype.prompt = function() {
+Interface.prototype.prompt = function(preserveCursor) {
if (this.enabled) {
- this.cursor = 0;
+ if (!preserveCursor) this.cursor = 0;
this._refreshLine();
} else {
this.output.write(this._prompt);
this.context = context;
};
-REPLServer.prototype.displayPrompt = function() {
+REPLServer.prototype.displayPrompt = function(preserveCursor) {
this.rli.setPrompt(this.bufferedCommand.length ?
'...' + new Array(this.lines.level.length).join('..') + ' ' :
this.prompt);
- this.rli.prompt();
+ this.rli.prompt(preserveCursor);
};