From f8c2a00894edf8aaca1a02a1f281e1e85f4ea5f8 Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 2 Oct 2024 23:20:52 +0200 Subject: [PATCH] fix: update position for self too --- lua/codemp/workspace.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/codemp/workspace.lua b/lua/codemp/workspace.lua index ce660b9..7134406 100644 --- a/lua/codemp/workspace.lua +++ b/lua/codemp/workspace.lua @@ -51,23 +51,27 @@ local function register_cursor_callback(controller, name) end local cur = utils.cursor.position() local buf = vim.api.nvim_get_current_buf() + local bufname if buffers.map[buf] ~= nil then + bufname = buffers.map[buf] once = true local _ = controller:send({ - buffer = buffers.map[buf], + buffer = bufname, start = cur[1], finish = cur[2], }) -- no need to await here else -- set ourselves "away" only once + bufname = "" if once then local _ = controller:send({ - buffer = "", + buffer = bufname, start = { 0, 0 }, finish = { 0, 0 }, }) -- no need to await here end once = false end + buffers.users[CODEMP.client.username] = bufname end }) end