Skip to content

Commit bb64cb7

Browse files
committed
fix(libuv): duplicated prev_line_content when stream EOF
When the stream ends (signified by `data` being `nil`), the function checked if there was any `prev_line_content` leftover. prev_line_content isn't nullified and will be used again in split_lines: ``` prev_line_content .. EOL .. prev_line_content ``` Fix #2636.
1 parent bde73a6 commit bb64cb7

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lua/fzf-lua/libuv.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,10 @@ M.spawn = function(opts, fn_transform, fn_done)
240240
--- Called with nil to process the leftover data
241241
---@param data string?
242242
local process_data = function(data)
243-
data = data or prev_line_content and (prev_line_content .. EOL) or nil
243+
if not data and prev_line_content then
244+
data = prev_line_content .. EOL
245+
prev_line_content = nil
246+
end
244247
if not data then
245248
-- NOTE: this isn't called when prev_line_content is not nil but that's
246249
-- not a problem as the write_cb will call finish once the callback is done

0 commit comments

Comments
 (0)