1
0
mirror of https://github.com/zu1k/nali.git synced 2025-01-22 21:29:02 +08:00

fix: the continuous two \n case.

This commit is contained in:
mzz2017 2022-08-14 22:37:48 +08:00
parent e86169b4cb
commit 264b95238a

View File

@ -14,7 +14,7 @@ func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error) {
if loc := newlineReg.FindIndex(data); len(loc) > 0 { if loc := newlineReg.FindIndex(data); len(loc) > 0 {
delimiterLen := 1 delimiterLen := 1
i := loc[0] i := loc[0]
if i+1 < len(data) && data[i+1] == '\n' { if i+1 < len(data) && data[i] == '\r' && data[i+1] == '\n' {
delimiterLen = 2 delimiterLen = 2
} }
return i + delimiterLen, data[:i], nil return i + delimiterLen, data[:i], nil