feat(views): add hide_done_categories config option (#153)

Problem: Categories where every task is done still render in the buffer,
cluttering the view when entire categories are finished.

Solution: Add `view.category.hide_done_categories` (boolean, default
false). When enabled, `category_view()` skips categories whose tasks are
all done/deleted, returns their IDs as `done_cat_hidden_ids`, and
`_on_write` merges those IDs into `hidden_ids` passed to `diff.apply()`
so hidden tasks are not mistakenly deleted on `:w`.
This commit is contained in:
Barrett Ruth 2026-03-12 20:19:27 -04:00 committed by Barrett Ruth
parent d18c0d3c82
commit 0707caf83c
6 changed files with 123 additions and 4 deletions

View file

@ -27,6 +27,8 @@ local _filter_predicates = {}
---@type table<integer, true>
local _hidden_ids = {}
---@type table<integer, true>
local _done_cat_hidden_ids = {}
---@type table<integer, true>
local _dirty_rows = {}
---@type boolean
local _on_bytes_active = false
@ -74,6 +76,11 @@ function M.hidden_ids()
return _hidden_ids
end
---@return table<integer, true>
function M.done_cat_hidden_ids()
return _done_cat_hidden_ids
end
---@param predicates string[]
---@param hidden table<integer, true>
---@return nil
@ -694,10 +701,13 @@ function M.render(bufnr)
end
local lines, line_meta
_done_cat_hidden_ids = {}
if current_view == 'priority' then
lines, line_meta = views.priority_view(tasks)
else
lines, line_meta = views.category_view(tasks)
local done_cat_hidden
lines, line_meta, done_cat_hidden = views.category_view(tasks)
_done_cat_hidden_ids = done_cat_hidden
end
if #lines == 0 and #_filter_predicates == 0 then