summaryrefslogtreecommitdiffstats
path: root/src/ui-todo.c
diff options
context:
space:
mode:
authorAmbika Eshwar <cepheac@protonmail.ch>2020-09-29 02:16:25 -0400
committerLukas Fleischer <lfleischer@calcurse.org>2020-10-11 09:59:37 -0400
commitb144b19964fcd5cfb99526641751823dea9bee9d (patch)
treef22109a0609be2868090c94efa24ed61a14745b9 /src/ui-todo.c
parent1b40844aa3b7a94fd84533ed6ef78a5c5cbac5f1 (diff)
downloadcalcurse-b144b19964fcd5cfb99526641751823dea9bee9d.tar.gz
calcurse-b144b19964fcd5cfb99526641751823dea9bee9d.zip
Implemented rendering of notes in todo view
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/ui-todo.c')
-rw-r--r--src/ui-todo.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/ui-todo.c b/src/ui-todo.c
index b546720..876f570 100644
--- a/src/ui-todo.c
+++ b/src/ui-todo.c
@@ -314,7 +314,27 @@ void ui_todo_popup_item(void)
if (!item)
return;
- item_in_popup(NULL, NULL, item->mesg, _("TODO:"));
+ if (item->note) {
+ /* Assign a sane default note size that will cleanly
+ * truncate long notes */
+ const char *note_heading = _("Note:");
+ size_t note_size = 3500;
+ char note[note_size];
+ char *notepath, *msg;
+ FILE *fp;
+
+ asprintf(&notepath, "%s%s", path_notes, item->note);
+ fp = fopen(notepath, "r");
+ note_read_contents(note, note_size, fp);
+ fclose(fp);
+ mem_free(notepath);
+
+ asprintf(&msg, "%s\n\n%s\n%s", item->mesg, note_heading, note);
+ item_in_popup(NULL, NULL, msg, _("TODO:"));
+ mem_free(msg);
+ } else {
+ item_in_popup(NULL, NULL, item->mesg, _("TODO:"));
+ }
}
void ui_todo_flag(void)