diff --git a/src/ui-todo.c b/src/ui-todo.c index 46933b3..0880690 100644 --- a/src/ui-todo.c +++ b/src/ui-todo.c @@ -228,8 +228,29 @@ void ui_todo_draw(int n, WINDOW *win, int y, int hilt, void *cb_data) } mesg = buf; } + + /* wbuf stores the wide char string + requires 4 extra chars: */ + // have to add CFLAG: -DNCURSES_WIDECHAR=1 + wchar_t wbuf[(strlen(mesg)+2)*2]; + if (todo->completed) { + wcscpy(wbuf, L"X"); + todo->note ? wcscat(wbuf, L">") : wcscat(wbuf, L"."); + wcscat(wbuf, L" "); + + wchar_t temp[2]; + temp[1] = L'\0'; + + for (size_t i = 0; i < strlen(mesg); i++) { + mbstowcs(&temp[0], &mesg[i], 1); + wcscat(wbuf, L"\u0336"); + wcscat(wbuf, temp); + } + } - mvwprintw(win, y, 0, "%s%s", mark, mesg); + if (todo->completed) { + mvwaddnwstr(win, y, 0, wbuf, -1); + } else { mvwprintw(win, y, 0, "%s%s", mark, mesg); } if (hilt) custom_remove_attr(win, ATTR_HIGHEST); @@ -295,6 +316,9 @@ void ui_todo_chg_priority(int diff) if (!item) return; + if (item->completed) + return; + int id = item->id + diff; struct todo *item_new;