From d2c9eb1808fee9c8d780d10f82b6bdc59169c1c7 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 24 Feb 2026 19:48:22 -0500 Subject: [PATCH] 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. --- lua/pending/init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/pending/init.lua b/lua/pending/init.lua index b6d9988..d03e454 100644 --- a/lua/pending/init.lua +++ b/lua/pending/init.lua @@ -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()