repl: fix space autocompletion bug

Tapping <SP> + <TAB> would exit the REPL.
pull/24503/head
Alex Kocharin 2012-03-20 05:44:22 +04:00 committed by Ben Noordhuis
parent 18240193ba
commit 415bff26fe
2 changed files with 14 additions and 0 deletions

View File

@ -589,6 +589,8 @@ REPLServer.prototype.complete = function(line, callback) {
} else {
completionGroupsLoaded();
}
} else {
completionGroupsLoaded();
}
// Will be called when all completionGroups are in place

View File

@ -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);
});