fix: set tick also when resynching

This commit is contained in:
əlemi 2024-11-17 17:01:55 +01:00
parent cc9b6769c2
commit ce6670fdb7
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -143,6 +143,7 @@ local function attach(name, opts)
if event.hash ~= nil and CODEMP.native.hash(utils.buffer.get_content(buffer)) ~= event.hash then if event.hash ~= nil and CODEMP.native.hash(utils.buffer.get_content(buffer)) ~= event.hash then
if CODEMP.config.auto_sync then if CODEMP.config.auto_sync then
print(" /!\\ out of sync, resynching...") print(" /!\\ out of sync, resynching...")
ticks[buffer] = vim.api.nvim_buf_get_changedtick(buffer)
utils.buffer.set_content(buffer, controller:content():await()) utils.buffer.set_content(buffer, controller:content():await())
else else
vim.ui.select( vim.ui.select(
@ -150,6 +151,7 @@ local function attach(name, opts)
{ prompt = "out of sync! force resync or detach?" }, { prompt = "out of sync! force resync or detach?" },
function (choice) function (choice)
if choice == "sync" then if choice == "sync" then
ticks[buffer] = vim.api.nvim_buf_get_changedtick(buffer)
utils.buffer.set_content(buffer, controller:content():await()) utils.buffer.set_content(buffer, controller:content():await())
end end
if choice == "detach" then if choice == "detach" then