feat(buffer): clear only inline extmarks on dirty rows during edits

Problem: `TextChanged` cleared all extmarks (both namespaces) on every
edit, causing EOL virtual text (due dates, recurrence) to vanish while
the user types.

Solution: replace blanket `clear_marks()` with per-row
`clear_inline_row()` that only removes `ns_inline` extmarks on rows
flagged dirty by `on_bytes`. EOL virtual text is preserved untouched.
This commit is contained in:
Barrett Ruth 2026-03-08 14:10:33 -04:00
parent db391c5715
commit ec08ca9645
2 changed files with 12 additions and 2 deletions

View file

@ -99,6 +99,13 @@ function M.clear_marks(b)
vim.api.nvim_buf_clear_namespace(bufnr, ns_inline, 0, -1)
end
---@param b integer
---@param row integer
---@return nil
function M.clear_inline_row(b, row)
vim.api.nvim_buf_clear_namespace(b, ns_inline, row - 1, row)
end
---@return table<integer, true>
function M.dirty_rows()
return _dirty_rows

View file

@ -255,8 +255,11 @@ function M._setup_autocmds(bufnr)
group = group,
buffer = bufnr,
callback = function()
if vim.bo[bufnr].modified then
buffer.clear_marks(bufnr)
if not vim.bo[bufnr].modified then
return
end
for row in pairs(buffer.dirty_rows()) do
buffer.clear_inline_row(bufnr, row)
end
end,
})