Skip to content

Commit 17aba39

Browse files
committed
fix(spawn): strip carriage return from lines
1 parent e68305d commit 17aba39

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lua/fzf-lua/libuv.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ M.spawn = function(opts, fn_transform, fn_done)
182182
repeat
183183
local nl_idx = data:find("\n", start_idx, true)
184184
if nl_idx then
185-
local line = data:sub(start_idx, nl_idx - 1)
185+
local cr = data:byte(nl_idx - 1, nl_idx - 1) == 13 -- \r
186+
local line = data:sub(start_idx, nl_idx - (cr and 2 or 1))
186187
if prev then
187188
line = prev .. line
188189
prev = nil

0 commit comments

Comments
 (0)