Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
readline: fix for terminals that insert newlines automatically
Browse files Browse the repository at this point in the history
Fixes #2985.
  • Loading branch information
rlidwka authored and TooTallNate committed Mar 26, 2012
1 parent e7792e5 commit ab518ae
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/readline.js
Expand Up @@ -269,7 +269,12 @@ Interface.prototype._insertString = function(c) {
} else {
this.line += c;
this.cursor += c.length;
this.output.write(c);

if (this._getCursorPos().cols === 0) {
this._refreshLine();
} else {
this.output.write(c);
}

// a hack to get the line refreshed if it's needed
this._moveCursor(0);
Expand Down Expand Up @@ -508,7 +513,7 @@ Interface.prototype._moveCursor = function(dx) {
var newPos = this._getCursorPos();

// check if cursors are in the same line
if (oldPos.rows == newPos.rows && newPos.cols != 0) {
if (oldPos.rows === newPos.rows) {
this.output.moveCursor(this.cursor - oldcursor, 0);
this.prevRows = newPos.rows;
} else {
Expand Down

0 comments on commit ab518ae

Please sign in to comment.