mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-12-23 22:04:52 +01:00
chore: removed old stuff
This commit is contained in:
parent
1803127828
commit
58315f3266
1 changed files with 0 additions and 11 deletions
|
@ -48,25 +48,14 @@ local function attach(name, force)
|
|||
)
|
||||
-- print(string.format("%s %s %s %s -- '%s'", start_row, start_col, start_row + new_end_row, start_col + new_end_col, content))
|
||||
controller:send(start_offset, start_offset + old_end_byte_len, content)
|
||||
-- controller:send_diff(utils.buffer.get_content(buf))
|
||||
end,
|
||||
})
|
||||
|
||||
-- This is an ugly as hell fix: basically we receive all operations real fast at the start
|
||||
-- so the buffer changes rapidly and it messes up tracking our delta/diff state and we
|
||||
-- get borked translated TextChanges (the underlying CRDT is fine)
|
||||
-- basically delay a bit so that it has time to sync and we can then get "normal slow" changes
|
||||
-- vim.loop.sleep(200) -- moved inside poller thread to at least not block ui
|
||||
|
||||
-- hook clientbound callbacks
|
||||
async.handler(name, controller, function(event)
|
||||
ticks[buffer] = vim.api.nvim_buf_get_changedtick(buffer)
|
||||
print(" ~~ applying change ~~ " .. event.first .. ".." .. event.last .. "::" .. event.content)
|
||||
utils.buffer.set_content(buffer, event.content, event.first, event.last)
|
||||
-- local before = utils.buffer.get_content(buffer)
|
||||
-- local after = event:apply(before)
|
||||
-- utils.buffer.set_content(buffer, after)
|
||||
-- buffer_replace_content(buffer, event.first, event.last, event.content)
|
||||
end, 20) -- wait 20ms before polling again because it overwhelms libuv?
|
||||
|
||||
print(" ++ attached to buffer " .. name)
|
||||
|
|
Loading…
Reference in a new issue