fix(init): reposition cursor after priority toggle re-render

Problem: pressing ! re-sorts the view so the toggled task moves to
the top of its category, but the cursor stays on the original line
number and lands on a different task.

Solution: after buffer.render(), iterate buffer.meta() to find the
new line number for the toggled task's id and call
nvim_win_set_cursor to follow it.
This commit is contained in:
Barrett Ruth 2026-02-24 19:48:22 -05:00 committed by Barrett Ruth
parent fe10422a34
commit e19e1c3edd

View file

@ -135,6 +135,12 @@ function M.toggle_priority()
store.update(id, { priority = new_priority })
store.save()
buffer.render(bufnr)
for lnum, m in ipairs(buffer.meta()) do
if m.id == id then
vim.api.nvim_win_set_cursor(0, { lnum, 0 })
break
end
end
end
function M.prompt_date()