fix: catch out-of-bounds line deletion sending

This commit is contained in:
əlemi 2024-09-09 02:49:49 +02:00
parent 3f5ce44b96
commit b141ca5a2a
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -46,6 +46,10 @@ local function attach(name, buffer, content, nowait)
change_content = ""
else
local actual_end_row = start_row + new_end_row
if new_byte_len == old_end_byte_len - 1 and new_end_row == old_end_row - 1 then
-- if just 1 byte changes and the line count changes, we deleted a line but getting text would mean going out of bounds
actual_end_row = actual_end_row - 1
end
local actual_end_col = new_end_col
if new_end_row == 0 then actual_end_col = new_end_col + start_col end
change_content = table.concat(