1. Added Feature to strikethrough TODO items

2. Requires adding -DNCURSES_WIDECHAR=1 to CFLAGS in src/Makefile

3. Made change so that priority cannot be changed on Completed TODO items.

Signed-off-by: gaurav-cheema <toasterbathbombv2@gmail.com>
This commit is contained in:
gaurav-cheema 2023-10-07 19:50:13 -07:00 committed by Yigid BALABAN
parent a665819060
commit f4f5d4fd43
Signed by: fyb
GPG Key ID: CF1BBD1336C0A3D6

View File

@ -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: <X . space nullchar> */
// 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;