summaryrefslogtreecommitdiff
path: root/src/ui-todo.c
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2016-01-18 18:52:24 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2016-01-18 18:52:24 +0100
commit25a049951cc955b51c2c30b977ebb6cfa7160054 (patch)
tree2d19f88a7d5b2c42ed9cda6e48f1849be3583355 /src/ui-todo.c
parent4bd8717d8087f77926c91fb52250bd8ec533af1a (diff)
downloadcalcurse-25a049951cc955b51c2c30b977ebb6cfa7160054.zip
Improve ordering of todo items
* Show uncompleted items first. * Order uncompleted and completed items by priority. * Order items with the same priority alphabetically. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/ui-todo.c')
-rw-r--r--src/ui-todo.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ui-todo.c b/src/ui-todo.c
index da5ec3e..b6da02d 100644
--- a/src/ui-todo.c
+++ b/src/ui-todo.c
@@ -120,7 +120,11 @@ void ui_todo_edit(void)
status_mesg(mesg, "");
updatestring(win[STA].p, &item->mesg, 0, 1);
+ todo_resort(item);
+ ui_todo_load_items();
io_set_modified();
+
+ listbox_set_sel(&lb_todo, todo_get_position(item));
}
/* Pipe a todo item to an external program. */
@@ -287,6 +291,7 @@ void ui_todo_chg_priority(int diff)
item_new = todo_add(item->mesg, id, item->completed, item->note);
todo_delete(item);
io_set_modified();
+
listbox_set_sel(&lb_todo, todo_get_position(item_new));
}
@@ -306,9 +311,10 @@ void ui_todo_flag(void)
struct todo *item = ui_todo_selitem();
todo_flag(item);
- if (ui_todo_view == TODO_HIDE_COMPLETED_VIEW)
- ui_todo_load_items();
+ ui_todo_load_items();
io_set_modified();
+
+ listbox_set_sel(&lb_todo, todo_get_position(item));
}
void ui_todo_view_note(void)