From 222869464f9d5057abbfca0494765d5a4b586cef Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 2 Oct 2024 14:18:28 +0200 Subject: [PATCH] fix: buf tick equals in theory it should always be the same, because we call set_content() and before that resolves our callback runs. HOWEVER, i dont know, nvim is driving me insane... --- lua/codemp/buffers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/codemp/buffers.lua b/lua/codemp/buffers.lua index 6559995..f015c8c 100644 --- a/lua/codemp/buffers.lua +++ b/lua/codemp/buffers.lua @@ -83,7 +83,7 @@ local function attach(name, opts) -- TODO breaks when deleting whole lines at buffer end vim.api.nvim_buf_attach(buffer, false, { on_bytes = function(_, buf, tick, start_row, start_col, start_offset, old_end_row, old_end_col, old_end_byte_len, new_end_row, new_end_col, new_byte_len) - if tick <= ticks[buf] then return end + if tick == ticks[buf] then return end if id_buffer_map[buf] == nil then return true end -- unregister callback handler if CODEMP.config.debug then print(string.format( "start(row:%s, col:%s) offset:%s end(row:%s, col:%s new(row:%s, col:%s)) len(old:%s, new:%s)",