mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-22 07:24:52 +01:00
chore: user->buffer mappings in buffers module
This commit is contained in:
parent
7e97777997
commit
733dca385b
2 changed files with 4 additions and 3 deletions
|
@ -3,6 +3,7 @@ local state = require('codemp.state')
|
|||
|
||||
local id_buffer_map = {}
|
||||
local buffer_id_map = {}
|
||||
local user_buffer_name = {}
|
||||
local ticks = {}
|
||||
|
||||
local function create(name, content)
|
||||
|
@ -124,4 +125,5 @@ return {
|
|||
map = id_buffer_map,
|
||||
map_rev = buffer_id_map,
|
||||
ticks = ticks,
|
||||
users = user_buffer_name,
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ local state = require('codemp.state')
|
|||
local window = require('codemp.window')
|
||||
|
||||
local user_hl = {}
|
||||
local user_buffer = {}
|
||||
local tree_buf = nil
|
||||
local available_colors = { -- TODO these are definitely not portable!
|
||||
"ErrorMsg",
|
||||
|
@ -42,11 +41,11 @@ local function register_cursor_handler(controller)
|
|||
hi = available_colors[ math.random( #available_colors ) ],
|
||||
}
|
||||
end
|
||||
local old_buffer = user_buffer[event.user]
|
||||
local old_buffer = buffers.users[event.user]
|
||||
if old_buffer ~= nil then
|
||||
vim.api.nvim_buf_clear_namespace(old_buffer, user_hl[event.user].ns, 0, -1)
|
||||
end
|
||||
user_buffer[event.user] = event.buffer
|
||||
buffers.users[event.user] = event.buffer
|
||||
local buffer = buffers.map_rev[event.buffer]
|
||||
if buffer ~= nil then
|
||||
utils.multiline_highlight(
|
||||
|
|
Loading…
Reference in a new issue