fix(picker.proc): correct offset for carriage returns. Fixes #599

This commit is contained in:
Folke Lemaitre 2025-01-18 09:47:09 +01:00
parent 0b67934bb9
commit a01e0f5368
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -80,7 +80,7 @@ function M.proc(opts)
while from <= #data do
local nl = data:find("\n", from, true)
if nl then
local cr = data:byte(nl - 2, nl - 2) == 13 -- \r
local cr = data:byte(nl - 1, nl - 1) == 13 -- \r
local line = data:sub(from, nl - (cr and 2 or 1))
if prev then
line, prev = prev .. line, nil