feat(views): add hide_done_categories config option
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`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
077e4121b4
commit
8d7759b6c4
6 changed files with 123 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue