summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/repl.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/repl.js b/lib/repl.js
index 6345c742f6..92c90de7bb 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -1229,20 +1229,20 @@ function complete(line, callback) {
// Completion group 0 is the "closest"
// (least far up the inheritance chain)
// so we put its completions last: to be closest in the REPL.
- for (i = completionGroups.length - 1; i >= 0; i--) {
+ for (i = 0; i < completionGroups.length; i++) {
group = completionGroups[i];
group.sort();
- for (var j = 0; j < group.length; j++) {
+ for (var j = group.length - 1; j >= 0; j--) {
c = group[j];
if (!hasOwnProperty(uniq, c)) {
- completions.push(c);
+ completions.unshift(c);
uniq[c] = true;
}
}
- completions.push(''); // Separator btwn groups
+ completions.unshift(''); // Separator btwn groups
}
- while (completions.length && completions[completions.length - 1] === '') {
- completions.pop();
+ while (completions.length && completions[0] === '') {
+ completions.shift();
}
}