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

Commit

Permalink
repl: fix space autocompletion bug
Browse files Browse the repository at this point in the history
Tapping <SP> + <TAB> would exit the REPL.
  • Loading branch information
rlidwka authored and bnoordhuis committed Mar 20, 2012
1 parent 1824019 commit 415bff2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/repl.js
Expand Up @@ -589,6 +589,8 @@ REPLServer.prototype.complete = function(line, callback) {
} else {
completionGroupsLoaded();
}
} else {
completionGroupsLoaded();
}

// Will be called when all completionGroups are in place
Expand Down
12 changes: 12 additions & 0 deletions test/simple/test-repl-tab-complete.js
Expand Up @@ -190,3 +190,15 @@ putIn.run([
testMe.complete('str.len', function(error, data) {
assert.deepEqual(data, [['str.length'], 'str.len']);
});

putIn.run(['.clear']);

// tab completion should not break on spaces
var spaceTimeout = setTimeout(function() {
throw new Error('timeout');
}, 1000);

testMe.complete(' ', function(error, data) {
assert.deepEqual(data, [[],undefined]);
clearTimeout(spaceTimeout);
});

0 comments on commit 415bff2

Please sign in to comment.