Skip to content

Instantly share code, notes, and snippets.

@scoates
Created August 8, 2010 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scoates/514195 to your computer and use it in GitHub Desktop.
Save scoates/514195 to your computer and use it in GitHub Desktop.
var readline = require('readline');
module.exports = readline;
readline.Interface.prototype.cursorToEnd = function() {
// place the cursor at the end of the current line
this.output.write(
'\x1b[0G\x1b[' + (
this._promptLength + this.line.length
) + 'C'
);
this.cursor = this.line.length;
}
diff --git a/lib/readline.js b/lib/readline.js
index 75ccf23..7c6f416 100644
--- a/lib/readline.js
+++ b/lib/readline.js
@@ -285,3 +285,4 @@ Interface.prototype._ttyWrite = function (b) {
}
};
+exports.Interface = Interface;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment