mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-22 15:34:53 +01:00
feat: track user positions
This commit is contained in:
parent
14a8bfe1f8
commit
f3c629237c
1 changed files with 3 additions and 0 deletions
|
@ -5,6 +5,7 @@ local buffers = require('codemp.buffers')
|
||||||
local async = require('codemp.async')
|
local async = require('codemp.async')
|
||||||
|
|
||||||
local user_hl = {}
|
local user_hl = {}
|
||||||
|
local user_buffer = {}
|
||||||
local tree_buf = nil
|
local tree_buf = nil
|
||||||
local available_colors = { -- TODO these are definitely not portable!
|
local available_colors = { -- TODO these are definitely not portable!
|
||||||
"ErrorMsg",
|
"ErrorMsg",
|
||||||
|
@ -37,6 +38,7 @@ local function register_cursor_handler(controller, workspace)
|
||||||
hi = available_colors[ math.random( #available_colors ) ],
|
hi = available_colors[ math.random( #available_colors ) ],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
user_buffer[event.user] = event.buffer
|
||||||
local buffer = buffers.map_rev[event.position.buffer]
|
local buffer = buffers.map_rev[event.position.buffer]
|
||||||
if buffer ~= nil then
|
if buffer ~= nil then
|
||||||
vim.api.nvim_buf_clear_namespace(buffer, user_hl[event.user].ns, 0, -1)
|
vim.api.nvim_buf_clear_namespace(buffer, user_hl[event.user].ns, 0, -1)
|
||||||
|
@ -88,6 +90,7 @@ return {
|
||||||
leave = leave,
|
leave = leave,
|
||||||
map = user_hl,
|
map = user_hl,
|
||||||
colors = available_colors,
|
colors = available_colors,
|
||||||
|
positions = user_buffer,
|
||||||
open_buffer_tree = open_buffer_tree,
|
open_buffer_tree = open_buffer_tree,
|
||||||
buffer_tree = tree_buf,
|
buffer_tree = tree_buf,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue