|
@ -138,17 +138,17 @@ Interface.prototype._refreshLine = function() { |
|
|
if (this._closed) return; |
|
|
if (this._closed) return; |
|
|
|
|
|
|
|
|
// Cursor to left edge.
|
|
|
// Cursor to left edge.
|
|
|
this.output.write('\x1b[0G'); |
|
|
this.output.cursorTo(0); |
|
|
|
|
|
|
|
|
// Write the prompt and the current buffer content.
|
|
|
// Write the prompt and the current buffer content.
|
|
|
this.output.write(this._prompt); |
|
|
this.output.write(this._prompt); |
|
|
this.output.write(this.line); |
|
|
this.output.write(this.line); |
|
|
|
|
|
|
|
|
// Erase to right.
|
|
|
// Erase to right.
|
|
|
this.output.write('\x1b[0K'); |
|
|
this.output.clearLine(1); |
|
|
|
|
|
|
|
|
// Move cursor to original position.
|
|
|
// Move cursor to original position.
|
|
|
this.output.write('\x1b[0G\x1b[' + (this._promptLength + this.cursor) + 'C'); |
|
|
this.output.cursorTo(this._promptLength + this.cursor); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -489,14 +489,14 @@ Interface.prototype._ttyWrite = function(b) { |
|
|
// left arrow
|
|
|
// left arrow
|
|
|
if (this.cursor > 0) { |
|
|
if (this.cursor > 0) { |
|
|
this.cursor--; |
|
|
this.cursor--; |
|
|
this.output.write('\x1b[0D'); |
|
|
this.output.moveCursor(-1, 0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} else if (b[1] === 91 && b[2] === 67) { |
|
|
} else if (b[1] === 91 && b[2] === 67) { |
|
|
// right arrow
|
|
|
// right arrow
|
|
|
if (this.cursor != this.line.length) { |
|
|
if (this.cursor != this.line.length) { |
|
|
this.cursor++; |
|
|
this.cursor++; |
|
|
this.output.write('\x1b[0C'); |
|
|
this.output.moveCursor(1, 0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} else if ((b[1] === 91 && b[2] === 72) || |
|
|
} else if ((b[1] === 91 && b[2] === 72) || |
|
|