preserve cursor pos
* configurable via .prompt()'s preserveCursor argument (false by default)
This commit is contained in:
parent
d9377f5eb0
commit
c07edd90f5
@ -867,7 +867,7 @@ Interface.prototype.childPrint = function(text) {
|
|||||||
}).map(function(chunk) {
|
}).map(function(chunk) {
|
||||||
return '< ' + chunk;
|
return '< ' + chunk;
|
||||||
}).join('\n'));
|
}).join('\n'));
|
||||||
this.repl.displayPrompt();
|
this.repl.displayPrompt(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Errors formatting
|
// Errors formatting
|
||||||
|
@ -125,9 +125,9 @@ Interface.prototype.setPrompt = function(prompt, length) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Interface.prototype.prompt = function() {
|
Interface.prototype.prompt = function(preserveCursor) {
|
||||||
if (this.enabled) {
|
if (this.enabled) {
|
||||||
this.cursor = 0;
|
if (!preserveCursor) this.cursor = 0;
|
||||||
this._refreshLine();
|
this._refreshLine();
|
||||||
} else {
|
} else {
|
||||||
this.output.write(this._prompt);
|
this.output.write(this._prompt);
|
||||||
|
@ -282,11 +282,11 @@ REPLServer.prototype.resetContext = function(force) {
|
|||||||
this.context = context;
|
this.context = context;
|
||||||
};
|
};
|
||||||
|
|
||||||
REPLServer.prototype.displayPrompt = function() {
|
REPLServer.prototype.displayPrompt = function(preserveCursor) {
|
||||||
this.rli.setPrompt(this.bufferedCommand.length ?
|
this.rli.setPrompt(this.bufferedCommand.length ?
|
||||||
'...' + new Array(this.lines.level.length).join('..') + ' ' :
|
'...' + new Array(this.lines.level.length).join('..') + ' ' :
|
||||||
this.prompt);
|
this.prompt);
|
||||||
this.rli.prompt();
|
this.rli.prompt(preserveCursor);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user