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:
parent
db391c5715
commit
ec08ca9645
2 changed files with 12 additions and 2 deletions
|
|
@ -99,6 +99,13 @@ function M.clear_marks(b)
|
||||||
vim.api.nvim_buf_clear_namespace(bufnr, ns_inline, 0, -1)
|
vim.api.nvim_buf_clear_namespace(bufnr, ns_inline, 0, -1)
|
||||||
end
|
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>
|
---@return table<integer, true>
|
||||||
function M.dirty_rows()
|
function M.dirty_rows()
|
||||||
return _dirty_rows
|
return _dirty_rows
|
||||||
|
|
|
||||||
|
|
@ -255,8 +255,11 @@ function M._setup_autocmds(bufnr)
|
||||||
group = group,
|
group = group,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function()
|
callback = function()
|
||||||
if vim.bo[bufnr].modified then
|
if not vim.bo[bufnr].modified then
|
||||||
buffer.clear_marks(bufnr)
|
return
|
||||||
|
end
|
||||||
|
for row in pairs(buffer.dirty_rows()) do
|
||||||
|
buffer.clear_inline_row(bufnr, row)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue