mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-12-23 05:44:52 +01:00
feat: now sync only sets buffer if necessary
does one extra get_content but worth it because we dont mess with undo history
This commit is contained in:
parent
087df96566
commit
b824b87505
1 changed files with 9 additions and 3 deletions
|
@ -126,9 +126,15 @@ local function sync(buffer)
|
|||
if name ~= nil then
|
||||
local controller = session.workspace:get_buffer(name)
|
||||
if controller ~= nil then
|
||||
ticks[buffer] = vim.api.nvim_buf_get_changedtick(buffer)
|
||||
utils.buffer.set_content(buffer, controller:content():await())
|
||||
print(" :: synched buffer " .. name)
|
||||
local real_content = controller:content():await()
|
||||
local my_content = utils.buffer.get_content(buffer)
|
||||
if real_content ~= my_content then
|
||||
ticks[buffer] = vim.api.nvim_buf_get_changedtick(buffer)
|
||||
utils.buffer.set_content(buffer, real_content)
|
||||
print(" !! re-synched buffer " .. name)
|
||||
else
|
||||
print(" :: buffer " .. name .. " is in sync")
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue