fix: insert at index 0, locked dep

This commit is contained in:
əlemi 2023-11-17 03:44:57 +01:00
parent f5a2412113
commit f69d91b9f6
2 changed files with 2 additions and 11 deletions

View file

@ -7,7 +7,7 @@ edition = "2021"
crate-type = ["cdylib"]
[dependencies]
codemp = { git = "ssh://git@github.com/codewithotherpeopleandchangenamelater/codemp.git", branch = "woot", features = ["global", "sync"] }
codemp = { git = "ssh://git@github.com/codewithotherpeopleandchangenamelater/codemp.git", rev = "486999bc31b8a925d56ee6d3747b06fcd97b00d5", features = ["global", "sync"] }
mlua = { version = "0.9.0", features = ["module", "luajit"] }
thiserror = "1.0.47"
derive_more = "0.99.17"

View file

@ -197,6 +197,7 @@ vim.api.nvim_create_user_command(
if tick <= codemp_changed_tick then return end
local start = vim.api.nvim_buf_get_offset(buf, firstline)
local content = table.concat(vim.api.nvim_buf_get_lines(buf, firstline, new_lastline, false), '\n')
if start == -1 then start = 0 end
if new_lastline < lastline then old_byte_size = old_byte_size + 1 end
controller:send(start, start + old_byte_size - 1, content)
end
@ -206,16 +207,6 @@ vim.api.nvim_create_user_command(
register_controller_handler(args.args, controller, function(event)
codemp_changed_tick = vim.api.nvim_buf_get_changedtick(buffer) + 1
buffer_set_content(buffer, event.content)
-- local start_row = vim.api.nvim_buf_get_offset(buffer, event.first)
-- local end_row = vim.api.nvim_buf_get_offset(buffer, event.last - 1)
-- vim.api.nvim_buf_set_text(
-- buffer,
-- start_row,
-- event.first - start_row,
-- end_row,
-- event.last - end_row,
-- vim.fn.split(event.content, '\n', true)
-- )
end)
print(" ++ joined workspace " .. args.args)