Implement on_reload buffer event callback

Should workaround unwanted cache invalidations. See #138, #139
This commit is contained in:
Lewis Russell 2021-04-12 00:05:11 +01:00
parent dddd7b3f1e
commit 7667121978
2 changed files with 10 additions and 0 deletions

View File

@ -518,6 +518,11 @@ local attach = async(function(cbuf)
api.nvim_buf_attach(cbuf, false, {
on_lines = function(_, buf, _, _, last_orig, last_new)
on_lines(buf, last_orig, last_new)
end,
on_reload = function()
end,
on_detach = function(_, buf)
detach(buf, true)

View File

@ -519,6 +519,11 @@ local attach = async(function(cbuf: integer)
on_lines = function(_, buf: integer, _, _, last_orig: integer, last_new: integer)
on_lines(buf, last_orig, last_new)
end,
on_reload = function()
-- FIXME (lewis6991) Dummy callback to prevent unwanted detach events
-- which Invalidate the cache. Probably need to update the signs here but
-- for now do nothing. See #138, #139.
end,
on_detach = function(_, buf: integer)
detach(buf, true)
end