| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d153a93 commit 2f7319e
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -597,6 +597,7 @@ class Interface extends InterfaceConstructor { | |||
| 597 | 597 | if (this[kLine_buffer]) { | |
| 598 | 598 | string = this[kLine_buffer] + string; | |
| 599 | 599 | this[kLine_buffer] = null; | |
| 600 | + lineEnding.lastIndex = 0; // Start the search from the beginning of the string. | ||
| 600 | 601 | newPartContainsEnding = RegExpPrototypeExec(lineEnding, string); | |
| 601 | 602 | } | |
| 602 | 603 | this[kSawReturnAt] = StringPrototypeEndsWith(string, '\r') ? | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,23 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + | ||
| 5 | + const assert = require('node:assert'); | ||
| 6 | + const readline = require('node:readline'); | ||
| 7 | + const { Readable } = require('node:stream'); | ||
| 8 | + | ||
| 9 | + | ||
| 10 | + const input = Readable.from((function*() { | ||
| 11 | + yield 'a\nb'; | ||
| 12 | + yield '\r\n'; | ||
| 13 | + })()); | ||
| 14 | + const rl = readline.createInterface({ input, crlfDelay: Infinity }); | ||
| 15 | + let carriageReturns = 0; | ||
| 16 | + | ||
| 17 | + rl.on('line', (line) => { | ||
| 18 | + if (line.includes('\r')) carriageReturns++; | ||
| 19 | + }); | ||
| 20 | + | ||
| 21 | + rl.on('close', common.mustCall(() => { | ||
| 22 | + assert.strictEqual(carriageReturns, 0); | ||
| 23 | + })); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments