diff options
author | Thomas <hakerh403@gmail.com> | 2019-03-19 14:19:38 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-03-30 13:34:39 +0100 |
commit | e4e2b0ce134ce781847272ae0b4bb889e75f223f (patch) | |
tree | f9a2be07984203976f0ad54a2c076d19d43daf3a /test/parallel/test-readline-interface.js | |
parent | 83c35dc6e82fa1b13281cc2af818cbc86723cab7 (diff) | |
download | android-node-v8-e4e2b0ce134ce781847272ae0b4bb889e75f223f.tar.gz android-node-v8-e4e2b0ce134ce781847272ae0b4bb889e75f223f.tar.bz2 android-node-v8-e4e2b0ce134ce781847272ae0b4bb889e75f223f.zip |
readline: replace quadratic regex with linear one
Simplify regular expression in _wordLeft and _deleteWordLeft readline
methods.
PR-URL: https://github.com/nodejs/node/pull/26778
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Diffstat (limited to 'test/parallel/test-readline-interface.js')
-rw-r--r-- | test/parallel/test-readline-interface.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index 5096198a71..2dff11f2a2 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -1272,3 +1272,26 @@ const crlfDelay = Infinity; }), delay); } }); + +// Ensure that the _wordLeft method works even for large input +{ + const input = new Readable({ + read() { + this.push('\x1B[1;5D'); // CTRL + Left + this.push(null); + }, + }); + const output = new Writable({ + write: common.mustCall((data, encoding, cb) => { + assert.strictEqual(rl.cursor, rl.line.length - 1); + cb(); + }), + }); + const rl = new readline.createInterface({ + input: input, + output: output, + terminal: true, + }); + rl.line = `a${' '.repeat(1e6)}a`; + rl.cursor = rl.line.length; +} |