feat(views): make queue view sort order configurable

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.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Barrett Ruth 2026-03-12 20:08:41 -04:00
parent 077e4121b4
commit 127c5d4ef7
4 changed files with 169 additions and 12 deletions

View file

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