-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This fixes a problem where tab completion is empty when the input stream column size is undefined. As a solution we can force maxColumns to 1 in this scenario. PR-URL: #2816 Fixes: #2396 Reviewed-By: Roman Reiss <me@silverwind.io>
- Loading branch information
1 parent
d63e02e
commit d4cd5ac
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
const PassThrough = require('stream').PassThrough; | ||
const readline = require('readline'); | ||
|
||
// Checks that tab completion still works | ||
// when output column size is undefined | ||
|
||
const iStream = new PassThrough(); | ||
const oStream = new PassThrough(); | ||
|
||
const rli = readline.createInterface({ | ||
terminal: true, | ||
input: iStream, | ||
output: oStream, | ||
completer: function(line, cb) { | ||
cb(null, [['process.stdout', 'process.stdin', 'process.stderr'], line]); | ||
} | ||
}); | ||
|
||
var output = ''; | ||
|
||
oStream.on('data', function(data) { | ||
output += data; | ||
}); | ||
|
||
oStream.on('end', function() { | ||
const expect = 'process.stdout\r\n' + | ||
'process.stdin\r\n' + | ||
'process.stderr'; | ||
assert(new RegExp(expect).test(output)); | ||
}); | ||
|
||
iStream.write('process.std\t'); | ||
oStream.end(); |