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:
parent
e86169b4cb
commit
264b95238a
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user