taskwiki
taskwiki copied to clipboard
Sorts strings naturally
A natural thing to do when sorting task list is to sort by urgency. If two tasks have same urgency, then I am not sure how the order is calculated. But, imagine you have the following tasks and viewport:
Read the new book | project:book $V
* [ ] Read chapter 1
* [ ] Read chapter 2
where $V
is urgency-,description+
. Suppose the two tasks have the same urgency. Imagine now that there are more chapters. In this case the listing would look like:
Read the new book | project:book $V
* [ ] Read chapter 1
* [ ] Read chapter 10
* [ ] Read chapter 11
* [ ] Read chapter 2
* [ ] Read chapter 3
* [ ] Read chapter 4
* [ ] Read chapter 5
* [ ] Read chapter 6
* [ ] Read chapter 7
* [ ] Read chapter 8
* [ ] Read chapter 9
This is obviously not the way it should be. The topmost tasks should be the ones that should be done first and chapter 10 should come after chapter 9. This is at least the assumption this PR makes. That in "series of tasks", i.e. multiple tasks sharing the same description except an ordinal number at the end, the sorting should be natural.
I am not sure this PR breaks anything. The test suite seems broken currently. Once fixed, I will add tests and address any edge cases.