fix: move buffer callback after

This commit is contained in:
əlemi 2024-09-05 04:37:48 +02:00
parent a250502a6d
commit c52c26e46b
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -78,13 +78,14 @@ local function attach(name, buffer, content)
end
end
end))
controller:callback(function (_controller) async:send() end)
vim.defer_fn(function() async:send() end, 500) -- force a try_recv after 500ms
local remote_content = controller:content():await()
ticks[buffer] = vim.api.nvim_buf_get_changedtick(buffer)
utils.buffer.set_content(buffer, remote_content)
controller:callback(function (_controller) async:send() end)
vim.defer_fn(function() async:send() end, 500) -- force a try_recv after 500ms
print(" ++ attached to buffer " .. name)
return controller
end