summaryrefslogtreecommitdiff
path: root/lib/readline.js
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2011-01-24 10:55:30 -0800
committerRyan Dahl <ry@tinyclouds.org>2011-01-24 10:55:30 -0800
commit9e976abad9879b473075a99ee5c66885ae7452e3 (patch)
treee220b7eff68baaa0388d474f426de6b831d4b3bd /lib/readline.js
parentf263b2914147c491a27ba49c8e2fe23fb3d81fd3 (diff)
downloadnode-new-9e976abad9879b473075a99ee5c66885ae7452e3.tar.gz
lint
Diffstat (limited to 'lib/readline.js')
-rw-r--r--lib/readline.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/readline.js b/lib/readline.js
index aba30985b8..5711c5c867 100644
--- a/lib/readline.js
+++ b/lib/readline.js
@@ -290,6 +290,7 @@ Interface.prototype._tabComplete = function() {
}
};
+
function commonPrefix(strings) {
if (!strings || strings.length == 0) {
return '';
@@ -305,6 +306,7 @@ function commonPrefix(strings) {
return min;
}
+
Interface.prototype._deleteLeft = function() {
if (this.cursor > 0 && this.line.length > 0) {
this.line = this.line.slice(0, this.cursor - 1) +
@@ -315,11 +317,13 @@ Interface.prototype._deleteLeft = function() {
}
};
+
Interface.prototype._deleteRight = function() {
this.line = this.line.slice(0, this.cursor) +
this.line.slice(this.cursor + 1, this.line.length);
this._refreshLine();
-}
+};
+
Interface.prototype._line = function() {
var line = this._addHistory();
@@ -327,6 +331,7 @@ Interface.prototype._line = function() {
this._onLine(line);
};
+
Interface.prototype._historyNext = function() {
if (this.historyIndex > 0) {
this.historyIndex--;
@@ -342,6 +347,7 @@ Interface.prototype._historyNext = function() {
}
};
+
Interface.prototype._historyPrev = function() {
if (this.historyIndex + 1 < this.history.length) {
this.historyIndex++;
@@ -478,7 +484,10 @@ Interface.prototype._ttyWrite = function(s, key) {
case 'f': // forward word
if (this.cursor < this.line.length) {
- next_word = this.line.slice(this.cursor, this.line.length).search(/\w/);
+ next_word = this.line
+ .slice(this.cursor, this.line.length)
+ .search(/\w/);
+
if (next_word !== -1) {
next_non_word = this.line.slice(this.cursor + next_word,
this.line.length).search(/\W/);
@@ -495,7 +504,10 @@ Interface.prototype._ttyWrite = function(s, key) {
case 'd': // delete forward word
if (this.cursor < this.line.length) {
- next_word = this.line.slice(this.cursor, this.line.length).search(/\w/);
+ next_word = this.line
+ .slice(this.cursor, this.line.length)
+ .search(/\w/);
+
if (next_word !== -1) {
next_non_word = this.line.slice(this.cursor + next_word,
this.line.length).search(/\W/);
@@ -586,4 +598,5 @@ Interface.prototype._ttyWrite = function(s, key) {
}
};
+
exports.Interface = Interface;