+static int show_new = 1;
+static int show_started = 1;
+static int show_finished = 1;
+
+/* Helper functions */
+static int print_todos(WINDOW *win, int y, todo_t *todos, status_t low, status_t high)
+{
+ int n = 0;
+ for (todo_t *cur = todos; cur; cur = cur->next)
+ if (low <= cur->status && cur->status <= high)
+ todo_line(win, cur, y+n++, 2, COLS-2, 1);
+ return n;
+}
+
+static int print_group(WINDOW *win, int y, todo_t *todos,
+ int show, const char *label, status_t low, status_t high)
+{
+ int n = 1;
+
+ /* Label */
+ mvwprintw(win, y, 0, "%s", label);
+
+ /* Todos */
+ if (show)
+ n = print_todos(win, y+1, todos, low, high);
+
+ /* Status */
+ if (!show)
+ mvwprintw(win, y+1, 4, "[hidden]");
+ if (n == 0)
+ mvwprintw(win, y+1, 4, "[no tasks]");
+
+ return y+1+MAX(n,1)+1;
+}
+