Skip to content

Commit 993b54b

Browse files
committed
Change output formatters to use different newline replacement regex
1 parent 1736ade commit 993b54b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/native-parser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ function getLineAndColumn (input, offset) {
1313
function pastInput (input, offset) {
1414
var start = Math.max(0, offset - 20)
1515
var previous = input.substr(start, offset - start)
16-
return (offset > 20 ? '...' : '') + previous.replace(/\n/g, '')
16+
return (offset > 20 ? '...' : '') + previous.replace(/\r?\n/g, '')
1717
}
1818

1919
function upcomingInput (input, offset) {
2020
var start = Math.max(0, offset - 20)
2121
start += offset - start
2222
var rest = input.length - start
2323
var next = input.substr(start, Math.min(20, rest))
24-
return next.replace(/\n/g, '') + (rest > 20 ? '...' : '')
24+
return next.replace(/\r?\n/g, '') + (rest > 20 ? '...' : '')
2525
}
2626

2727
function getPositionContext (input, offset) {

0 commit comments

Comments
 (0)