From 3f5ce44b9687da39e9a077c6fb6ff808a1420095 Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 9 Sep 2024 02:37:50 +0200 Subject: [PATCH] fix: sending change across multiple lines --- lua/codemp/buffers.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/codemp/buffers.lua b/lua/codemp/buffers.lua index 57a961a..601c89d 100644 --- a/lua/codemp/buffers.lua +++ b/lua/codemp/buffers.lua @@ -45,8 +45,11 @@ local function attach(name, buffer, content, nowait) if new_byte_len == 0 then change_content = "" else + local actual_end_row = start_row + new_end_row + 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( - vim.api.nvim_buf_get_text(buf, start_row, start_col, start_row + new_end_row, start_col + new_end_col, {}), + vim.api.nvim_buf_get_text(buf, start_row, start_col, actual_end_row, actual_end_col, {}), '\n' ) end