feat(views): make queue view sort order configurable (#154)

Problem: the queue/priority view sort in `sort_tasks_priority()` uses a
hardcoded tiebreak chain (status, priority, due, order, id). Users who
care more about due dates than priority have no way to reorder it.

Solution: add `view.queue.sort` config field (string[]) that defines an
ordered tiebreak chain. `build_queue_comparator()` maps each key to a
comparison function and returns a single comparator. Unknown keys emit a
`log.warn`. The default matches the previous hardcoded behavior.
This commit is contained in:
Barrett Ruth 2026-03-12 20:19:36 -04:00 committed by Barrett Ruth
parent 283f93eda1
commit 969dbd299f
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
4 changed files with 169 additions and 12 deletions

View file

@ -87,6 +87,7 @@
---@field hide_done_categories? boolean
---@class pending.QueueViewConfig
---@field sort? string[]
---@class pending.ViewConfig
---@field default? 'category'|'priority'
@ -133,7 +134,9 @@ local defaults = {
folding = true,
hide_done_categories = false,
},
queue = {},
queue = {
sort = { 'status', 'priority', 'due', 'order', 'id' },
},
},
keymaps = {
close = 'q',