mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-22 15:34:53 +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()
|
timer:start(500, 500, function()
|
||||||
if promise == nil then promise = generator() end
|
if promise == nil then promise = generator() end
|
||||||
if promise.ready then
|
if promise.ready then
|
||||||
callback(promise:await())
|
vim.schedule(function() callback(promise:await()) end)
|
||||||
promise = nil
|
promise = nil
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -117,12 +117,10 @@ local function join(workspace)
|
||||||
function(event)
|
function(event)
|
||||||
if event.type == "leave" then
|
if event.type == "leave" then
|
||||||
if buffers.users[event.value] ~= nil then
|
if buffers.users[event.value] ~= nil then
|
||||||
vim.schedule(function ()
|
local buf_name = buffers.users[event.value]
|
||||||
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)
|
||||||
vim.api.nvim_buf_clear_namespace(buffers.map_rev[buf_name], user_hl[event.value].ns, 0, -1)
|
buffers.users[event.value] = nil
|
||||||
buffers.users[event.value] = nil
|
user_hl[event.value] = nil
|
||||||
user_hl[event.value] = nil
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
elseif event.type == "join" then
|
elseif event.type == "join" then
|
||||||
buffers.users[event.value] = ""
|
buffers.users[event.value] = ""
|
||||||
|
@ -132,7 +130,7 @@ local function join(workspace)
|
||||||
pos = { 0, 0 },
|
pos = { 0, 0 },
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
vim.schedule(function() require('codemp.window').update() end)
|
require('codemp.window').update()
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue