diff options
author | Anna Henningsen <anna@addaleax.net> | 2016-07-15 23:33:16 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2016-08-04 23:32:38 +0200 |
commit | 1a9e247c794274942683d2e77db098c9494ddde5 (patch) | |
tree | 8bf3d4e32e050824f01f484c0af443ea6641e8f2 /test/parallel/test-readline-undefined-columns.js | |
parent | c809b8834541bf63b1a43d5a12833d98ffba834f (diff) | |
download | android-node-v8-1a9e247c794274942683d2e77db098c9494ddde5.tar.gz android-node-v8-1a9e247c794274942683d2e77db098c9494ddde5.tar.bz2 android-node-v8-1a9e247c794274942683d2e77db098c9494ddde5.zip |
readline: show completions only after 2nd TAB
Show `TAB` completion suggestions only after the user has pressed `TAB`
twice in a row, so that the full list of suggestions doesn’t present
a distraction. The first time a `TAB` key is pressed, only partial
longest-common-prefix completion is performed.
This moves the `readline` autocompletion a lot closer to what e.g.
`bash` does.
Fixes: https://github.com/nodejs/node/issues/7665
PR-URL: https://github.com/nodejs/node/pull/7754
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-readline-undefined-columns.js')
-rw-r--r-- | test/parallel/test-readline-undefined-columns.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/test/parallel/test-readline-undefined-columns.js b/test/parallel/test-readline-undefined-columns.js index f3197ff59a..5f8a1c02d3 100644 --- a/test/parallel/test-readline-undefined-columns.js +++ b/test/parallel/test-readline-undefined-columns.js @@ -1,6 +1,6 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const PassThrough = require('stream').PassThrough; const readline = require('readline'); @@ -26,12 +26,17 @@ oStream.on('data', function(data) { output += data; }); -oStream.on('end', function() { +oStream.on('end', common.mustCall(() => { const expect = 'process.stdout\r\n' + 'process.stdin\r\n' + 'process.stderr'; assert(new RegExp(expect).test(output)); -}); +})); + +iStream.write('process.s\t'); + +assert(/process.std\b/.test(output)); // Completion works. +assert(!/stdout/.test(output)); // Completion doesn’t show all results yet. -iStream.write('process.std\t'); +iStream.write('\t'); oStream.end(); |