mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-22 07:24:52 +01:00
feat: clear cursor on user leave, redraw windows
This commit is contained in:
parent
733dca385b
commit
625bcb504d
1 changed files with 15 additions and 3 deletions
|
@ -56,6 +56,9 @@ local function register_cursor_handler(controller)
|
|||
event.finish
|
||||
)
|
||||
end
|
||||
if old_buffer ~= buffer then
|
||||
window.update() -- redraw user positions
|
||||
end
|
||||
end
|
||||
end))
|
||||
controller:callback(function (_controller) async:send() end)
|
||||
|
@ -66,9 +69,18 @@ local function join(workspace)
|
|||
register_cursor_callback(ws.cursor)
|
||||
register_cursor_handler(ws.cursor)
|
||||
|
||||
-- ws:callback(function (_ev)
|
||||
-- vim.schedule(function() window.update() end)
|
||||
-- end)
|
||||
ws:callback(function (event)
|
||||
if event.type == "leave" then
|
||||
if buffers.users[event.value] ~= nil then
|
||||
vim.schedule(function ()
|
||||
vim.api.nvim_buf_clear_namespace(buffers.users[event.value], user_hl[event.value].ns, 0, -1)
|
||||
buffers.users[event.value] = nil
|
||||
user_hl[event.value] = nil
|
||||
end)
|
||||
end
|
||||
end
|
||||
vim.schedule(function() window.update() end)
|
||||
end)
|
||||
window.update()
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue