mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-22 15:34:53 +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
|
event.finish
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
if old_buffer ~= buffer then
|
||||||
|
window.update() -- redraw user positions
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end))
|
end))
|
||||||
controller:callback(function (_controller) async:send() end)
|
controller:callback(function (_controller) async:send() end)
|
||||||
|
@ -66,9 +69,18 @@ local function join(workspace)
|
||||||
register_cursor_callback(ws.cursor)
|
register_cursor_callback(ws.cursor)
|
||||||
register_cursor_handler(ws.cursor)
|
register_cursor_handler(ws.cursor)
|
||||||
|
|
||||||
-- ws:callback(function (_ev)
|
ws:callback(function (event)
|
||||||
-- vim.schedule(function() window.update() end)
|
if event.type == "leave" then
|
||||||
-- end)
|
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()
|
window.update()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue