aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2016-01-27 23:56:39 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2016-01-27 23:56:39 +0100
commitd127ce944774e500daff4453f0f12bb689d0f3f7 (patch)
tree17ef7db7021d9bc77f5f66bb25a000e5add5fc30 /src
parentebe483c0584c839a2890db1e4a43b0526ed738d8 (diff)
downloadcalcurse-d127ce944774e500daff4453f0f12bb689d0f3f7.tar.gz
calcurse-d127ce944774e500daff4453f0f12bb689d0f3f7.zip
Display priority todo items above regular items
We now support todo items with undefined priority and currently display them above todo items with a strictly positive priority. Change this and always list items with a priority greater than zero first. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src')
-rw-r--r--src/todo.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/todo.c b/src/todo.c
index 970991a..8bdd1af 100644
--- a/src/todo.c
+++ b/src/todo.c
@@ -68,6 +68,10 @@ static int todo_cmp(struct todo *a, struct todo *b)
return 1;
if (b->completed && !a->completed)
return -1;
+ if (a->id > 0 && b->id == 0)
+ return -1;
+ if (b->id > 0 && a->id == 0)
+ return 1;
if (a->id == b->id)
return strcmp(a->mesg, b->mesg);