fix: update position for self too

This commit is contained in:
əlemi 2024-10-02 23:20:52 +02:00
parent 3f71b36ccd
commit f8c2a00894
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -51,23 +51,27 @@ local function register_cursor_callback(controller, name)
end end
local cur = utils.cursor.position() local cur = utils.cursor.position()
local buf = vim.api.nvim_get_current_buf() local buf = vim.api.nvim_get_current_buf()
local bufname
if buffers.map[buf] ~= nil then if buffers.map[buf] ~= nil then
bufname = buffers.map[buf]
once = true once = true
local _ = controller:send({ local _ = controller:send({
buffer = buffers.map[buf], buffer = bufname,
start = cur[1], start = cur[1],
finish = cur[2], finish = cur[2],
}) -- no need to await here }) -- no need to await here
else -- set ourselves "away" only once else -- set ourselves "away" only once
bufname = ""
if once then if once then
local _ = controller:send({ local _ = controller:send({
buffer = "", buffer = bufname,
start = { 0, 0 }, start = { 0, 0 },
finish = { 0, 0 }, finish = { 0, 0 },
}) -- no need to await here }) -- no need to await here
end end
once = false once = false
end end
buffers.users[CODEMP.client.username] = bufname
end end
}) })
end end