mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-12-23 05:44:52 +01:00
fix: run poller callbacks on main thread
This commit is contained in:
parent
b80d1898be
commit
ecf58046b5
2 changed files with 6 additions and 8 deletions
|
@ -22,7 +22,7 @@ local function async_poller(generator, callback)
|
|||
timer:start(500, 500, function()
|
||||
if promise == nil then promise = generator() end
|
||||
if promise.ready then
|
||||
callback(promise:await())
|
||||
vim.schedule(function() callback(promise:await()) end)
|
||||
promise = nil
|
||||
end
|
||||
end)
|
||||
|
|
|
@ -117,12 +117,10 @@ local function join(workspace)
|
|||
function(event)
|
||||
if event.type == "leave" then
|
||||
if buffers.users[event.value] ~= nil then
|
||||
vim.schedule(function ()
|
||||
local buf_name = buffers.users[event.value]
|
||||
vim.api.nvim_buf_clear_namespace(buffers.map_rev[buf_name], user_hl[event.value].ns, 0, -1)
|
||||
buffers.users[event.value] = nil
|
||||
user_hl[event.value] = nil
|
||||
end)
|
||||
local buf_name = buffers.users[event.value]
|
||||
vim.api.nvim_buf_clear_namespace(buffers.map_rev[buf_name], user_hl[event.value].ns, 0, -1)
|
||||
buffers.users[event.value] = nil
|
||||
user_hl[event.value] = nil
|
||||
end
|
||||
elseif event.type == "join" then
|
||||
buffers.users[event.value] = ""
|
||||
|
@ -132,7 +130,7 @@ local function join(workspace)
|
|||
pos = { 0, 0 },
|
||||
}
|
||||
end
|
||||
vim.schedule(function() require('codemp.window').update() end)
|
||||
require('codemp.window').update()
|
||||
end
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue