mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-18 02:55:11 +00:00
Do not trim CR on Windows when --read0 is set
This commit is contained in:
parent
9b9ad77e1c
commit
68a35e4735
@ -127,8 +127,10 @@ func (r *Reader) feed(src io.Reader) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
delim := byte('\n')
|
delim := byte('\n')
|
||||||
|
trimCR := util.IsWindows()
|
||||||
if r.delimNil {
|
if r.delimNil {
|
||||||
delim = '\000'
|
delim = '\000'
|
||||||
|
trimCR = false
|
||||||
}
|
}
|
||||||
|
|
||||||
slab := make([]byte, readerSlabSize)
|
slab := make([]byte, readerSlabSize)
|
||||||
@ -157,7 +159,7 @@ func (r *Reader) feed(src io.Reader) {
|
|||||||
// Found the delimiter
|
// Found the delimiter
|
||||||
slice := buf[:i+1]
|
slice := buf[:i+1]
|
||||||
buf = buf[i+1:]
|
buf = buf[i+1:]
|
||||||
if util.IsWindows() && len(slice) >= 2 && slice[len(slice)-2] == byte('\r') {
|
if trimCR && len(slice) >= 2 && slice[len(slice)-2] == byte('\r') {
|
||||||
slice = slice[:len(slice)-2]
|
slice = slice[:len(slice)-2]
|
||||||
} else {
|
} else {
|
||||||
slice = slice[:len(slice)-1]
|
slice = slice[:len(slice)-1]
|
||||||
|
Loading…
Reference in New Issue
Block a user