Revert "feat(views): add hide_done_categories config option (#153)"
This reverts commit 283f93eda1.
This commit is contained in:
parent
7c0ba178d0
commit
e6816d13ef
6 changed files with 4 additions and 123 deletions
|
|
@ -27,8 +27,6 @@ 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
|
||||
|
|
@ -76,11 +74,6 @@ 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
|
||||
|
|
@ -701,13 +694,10 @@ 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
|
||||
local done_cat_hidden
|
||||
lines, line_meta, done_cat_hidden = views.category_view(tasks)
|
||||
_done_cat_hidden_ids = done_cat_hidden
|
||||
lines, line_meta = views.category_view(tasks)
|
||||
end
|
||||
|
||||
if #lines == 0 and #_filter_predicates == 0 then
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@
|
|||
---@class pending.CategoryViewConfig
|
||||
---@field order? string[]
|
||||
---@field folding? boolean|pending.FoldingConfig
|
||||
---@field hide_done_categories? boolean
|
||||
|
||||
---@class pending.QueueViewConfig
|
||||
---@field sort? string[]
|
||||
|
|
@ -132,7 +131,6 @@ local defaults = {
|
|||
category = {
|
||||
order = {},
|
||||
folding = true,
|
||||
hide_done_categories = false,
|
||||
},
|
||||
queue = {
|
||||
sort = { 'status', 'priority', 'due', 'order', 'id' },
|
||||
|
|
|
|||
|
|
@ -513,9 +513,6 @@ function M._on_write(bufnr)
|
|||
if #stack > UNDO_MAX then
|
||||
table.remove(stack, 1)
|
||||
end
|
||||
for id in pairs(buffer.done_cat_hidden_ids()) do
|
||||
hidden[id] = true
|
||||
end
|
||||
local new_refs = diff.apply(lines, s, hidden)
|
||||
M._recompute_counts()
|
||||
buffer.render(bufnr)
|
||||
|
|
|
|||
|
|
@ -189,7 +189,6 @@ end
|
|||
---@param tasks pending.Task[]
|
||||
---@return string[] lines
|
||||
---@return pending.LineMeta[] meta
|
||||
---@return table<integer, true> done_cat_hidden_ids
|
||||
function M.category_view(tasks)
|
||||
local by_cat = {}
|
||||
local cat_order = {}
|
||||
|
|
@ -229,9 +228,6 @@ function M.category_view(tasks)
|
|||
cat_order = ordered
|
||||
end
|
||||
|
||||
local hide_done = config.get().view.category.hide_done_categories
|
||||
local done_cat_hidden = {} ---@type table<integer, true>
|
||||
|
||||
for _, cat in ipairs(cat_order) do
|
||||
sort_tasks(by_cat[cat])
|
||||
sort_tasks(done_by_cat[cat])
|
||||
|
|
@ -239,21 +235,12 @@ function M.category_view(tasks)
|
|||
|
||||
local lines = {}
|
||||
local meta = {}
|
||||
local rendered = 0
|
||||
|
||||
for _, cat in ipairs(cat_order) do
|
||||
if hide_done and #by_cat[cat] == 0 and #done_by_cat[cat] > 0 then
|
||||
for _, t in ipairs(done_by_cat[cat]) do
|
||||
done_cat_hidden[t.id] = true
|
||||
end
|
||||
goto next_cat
|
||||
end
|
||||
|
||||
if rendered > 0 then
|
||||
for i, cat in ipairs(cat_order) do
|
||||
if i > 1 then
|
||||
table.insert(lines, '')
|
||||
table.insert(meta, { type = 'blank' })
|
||||
end
|
||||
rendered = rendered + 1
|
||||
table.insert(lines, '# ' .. cat)
|
||||
table.insert(meta, { type = 'header', category = cat })
|
||||
|
||||
|
|
@ -284,11 +271,9 @@ function M.category_view(tasks)
|
|||
forge_spans = compute_forge_spans(task, prefix_len),
|
||||
})
|
||||
end
|
||||
|
||||
::next_cat::
|
||||
end
|
||||
|
||||
return lines, meta, done_cat_hidden
|
||||
return lines, meta
|
||||
end
|
||||
|
||||
---@param tasks pending.Task[]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue