feat(buffer): re-apply inline extmarks after edits

Problem: inline extmarks (checkbox overlays, strikethrough, header
highlights) were cleared during edits and only restored on `:w`,
leaving the buffer visually bare while editing.

Solution: extract `apply_inline_row()` from `apply_extmarks()` and
call it via `reapply_dirty_inline()` on `InsertLeave` and normal-mode
`TextChanged`. Insert-mode `TextChangedI` still only clears inline
marks on dirty rows to avoid overlay flicker while typing.
This commit is contained in:
Barrett Ruth 2026-03-08 14:12:03 -04:00
parent ec08ca9645
commit e71d6cdff6
2 changed files with 88 additions and 42 deletions

View file

@ -251,7 +251,7 @@ function M._setup_autocmds(bufnr)
end
end,
})
vim.api.nvim_create_autocmd({ 'TextChanged', 'TextChangedI' }, {
vim.api.nvim_create_autocmd('TextChangedI', {
group = group,
buffer = bufnr,
callback = function()
@ -263,6 +263,25 @@ function M._setup_autocmds(bufnr)
end
end,
})
vim.api.nvim_create_autocmd('TextChanged', {
group = group,
buffer = bufnr,
callback = function()
if not vim.bo[bufnr].modified then
return
end
buffer.reapply_dirty_inline(bufnr)
end,
})
vim.api.nvim_create_autocmd('InsertLeave', {
group = group,
buffer = bufnr,
callback = function()
if vim.bo[bufnr].modified then
buffer.reapply_dirty_inline(bufnr)
end
end,
})
vim.api.nvim_create_autocmd('WinClosed', {
group = group,
callback = function(ev)