From 25a049951cc955b51c2c30b977ebb6cfa7160054 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Mon, 18 Jan 2016 18:52:24 +0100 Subject: 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 --- src/ui-todo.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/ui-todo.c') 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) -- cgit v1.2.3-54-g00ecf