From ec08ca96452d62287885d91bb9c5aef53542311a Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sun, 8 Mar 2026 14:10:33 -0400 Subject: [PATCH] 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. --- lua/pending/buffer.lua | 7 +++++++ lua/pending/init.lua | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lua/pending/buffer.lua b/lua/pending/buffer.lua index 367a8bb..79cd2c6 100644 --- a/lua/pending/buffer.lua +++ b/lua/pending/buffer.lua @@ -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 function M.dirty_rows() return _dirty_rows diff --git a/lua/pending/init.lua b/lua/pending/init.lua index af018a7..3e8702d 100644 --- a/lua/pending/init.lua +++ b/lua/pending/init.lua @@ -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, })