Browse Source

repl: fix space autocompletion bug

Tapping <SP> + <TAB> would exit the REPL.
v0.9.1-release
Alex Kocharin 13 years ago
committed by Ben Noordhuis
parent
commit
415bff26fe
  1. 2
      lib/repl.js
  2. 12
      test/simple/test-repl-tab-complete.js

2
lib/repl.js

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

12
test/simple/test-repl-tab-complete.js

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

Loading…
Cancel
Save