diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/apoint.c | 2 | ||||
-rw-r--r-- | src/args.c | 4 | ||||
-rw-r--r-- | src/calcurse.c | 2 | ||||
-rw-r--r-- | src/calcurse.h | 3 | ||||
-rw-r--r-- | src/config.c | 2 | ||||
-rw-r--r-- | src/custom.c | 2 | ||||
-rw-r--r-- | src/day.c | 32 | ||||
-rw-r--r-- | src/dmon.c | 4 | ||||
-rw-r--r-- | src/event.c | 2 | ||||
-rw-r--r-- | src/getstring.c | 2 | ||||
-rw-r--r-- | src/help.c | 2 | ||||
-rw-r--r-- | src/hooks.c | 2 | ||||
-rw-r--r-- | src/htable.h | 2 | ||||
-rw-r--r-- | src/ical.c | 15 | ||||
-rw-r--r-- | src/io.c | 2 | ||||
-rw-r--r-- | src/keys.c | 93 | ||||
-rw-r--r-- | src/listbox.c | 2 | ||||
-rw-r--r-- | src/llist.c | 2 | ||||
-rw-r--r-- | src/llist.h | 2 | ||||
-rw-r--r-- | src/llist_ts.h | 2 | ||||
-rw-r--r-- | src/mem.c | 2 | ||||
-rw-r--r-- | src/note.c | 2 | ||||
-rw-r--r-- | src/notify.c | 2 | ||||
-rw-r--r-- | src/pcal.c | 2 | ||||
-rw-r--r-- | src/queue.c | 2 | ||||
-rw-r--r-- | src/recur.c | 36 | ||||
-rw-r--r-- | src/sha1.c | 2 | ||||
-rw-r--r-- | src/sha1.h | 2 | ||||
-rw-r--r-- | src/sigs.c | 2 | ||||
-rw-r--r-- | src/strings.c | 3 | ||||
-rw-r--r-- | src/todo.c | 2 | ||||
-rw-r--r-- | src/ui-calendar.c | 13 | ||||
-rw-r--r-- | src/ui-day.c | 2 | ||||
-rw-r--r-- | src/ui-todo.c | 23 | ||||
-rw-r--r-- | src/utf8.c | 2 | ||||
-rw-r--r-- | src/utils.c | 2 | ||||
-rw-r--r-- | src/vars.c | 4 | ||||
-rw-r--r-- | src/vector.c | 2 | ||||
-rw-r--r-- | src/vector.h | 2 | ||||
-rw-r--r-- | src/wins.c | 2 |
40 files changed, 184 insertions, 104 deletions
diff --git a/src/apoint.c b/src/apoint.c index d6e9bc1..e138e5e 100644 --- a/src/apoint.c +++ b/src/apoint.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -112,7 +112,7 @@ static void version_arg(void) { printf(_("calcurse %s -- text-based organizer\n"), VERSION); putchar('\n'); - printf("%s\n", _("Copyright (c) 2004-2022 calcurse Development Team.")); + printf("%s\n", _("Copyright (c) 2004-2023 calcurse Development Team.")); printf("%s\n", _("This is free software; see the source for copying conditions.")); } diff --git a/src/calcurse.c b/src/calcurse.c index 84d1a9b..c89d1dd 100644 --- a/src/calcurse.c +++ b/src/calcurse.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/calcurse.h b/src/calcurse.h index ee96bbe..8322416 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -307,6 +307,7 @@ struct conf { }; #define EMPTY_DAY_DEFAULT "--" +#define EMPTY_EVENT_DESC_DEFAULT _("(empty description)") /* Daemon-related configuration. */ struct dmon_conf { diff --git a/src/config.c b/src/config.c index 9e2e40e..4e0f7db 100644 --- a/src/config.c +++ b/src/config.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/custom.c b/src/custom.c index 13570c6..2cd385c 100644 --- a/src/custom.c +++ b/src/custom.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -198,7 +198,8 @@ static void day_add_item(int type, time_t start, time_t order, union aptev_ptr i /* Get the message of an item. */ char *day_item_get_mesg(struct day_item *day) { - switch (day->type) { + switch (day->type) + { case APPT: return day->item.apt->mesg; case EVNT: @@ -212,6 +213,15 @@ char *day_item_get_mesg(struct day_item *day) } } +/* Get the display message of an item. */ +char *day_item_get_display_mesg(struct day_item *day) +{ + char *msg = day_item_get_mesg(day); + if (msg[0] == '\0') + return EMPTY_EVENT_DESC_DEFAULT; + return msg; +} + /* Get the note attached to an item. */ char *day_item_get_note(struct day_item *day) { @@ -529,7 +539,7 @@ day_display_item(struct day_item *day, WINDOW *win, int incolor, int width, if (width <= 0) return; - char *mesg = day_item_get_mesg(day); + char *mesg = day_item_get_display_mesg(day); ch_recur = (day->type == RECUR_EVNT) ? '*' : ' '; ch_note = day_item_get_note(day) ? '>' : ' '; @@ -624,15 +634,19 @@ void day_popup_item(struct day_item *day) asprintf(¬epath, "%s%s", path_notes, day_item_get_note(day)); fp = fopen(notepath, "r"); + if (fp == NULL) { + item_in_popup(NULL, NULL, day_item_get_mesg(day), _("Event:")); + return; + } note_read_contents(note, note_size, fp); fclose(fp); mem_free(notepath); - asprintf(&msg, "%s\n\n%s\n%s", day_item_get_mesg(day), note_heading, note); + asprintf(&msg, "%s\n\n%s\n%s", day_item_get_display_mesg(day), note_heading, note); item_in_popup(NULL, NULL, msg, _("Event:")); mem_free(msg); } else { - item_in_popup(NULL, NULL, day_item_get_mesg(day), _("Event:")); + item_in_popup(NULL, NULL, day_item_get_display_mesg(day), _("Event:")); } } else if (day->type == APPT || day->type == RECUR_APPT) { char a_st[100], a_end[100]; @@ -651,15 +665,19 @@ void day_popup_item(struct day_item *day) asprintf(¬epath, "%s%s", path_notes, day_item_get_note(day)); fp = fopen(notepath, "r"); + if (fp == NULL) { + item_in_popup(a_st, a_end, day_item_get_mesg(day), _("Appointment:")); + return; + } note_read_contents(note, note_size, fp); fclose(fp); mem_free(notepath); - asprintf(&msg, "%s\n\n%s\n%s", day_item_get_mesg(day), note_heading, note); + asprintf(&msg, "%s\n\n%s\n%s", day_item_get_display_mesg(day), note_heading, note); item_in_popup(a_st, a_end, msg, _("Appointment:")); mem_free(msg); } else { - item_in_popup(a_st, a_end, day_item_get_mesg(day), _("Appointment:")); + item_in_popup(a_st, a_end, day_item_get_display_mesg(day), _("Appointment:")); } } else { EXIT(_("unknown item type")); @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,7 +54,7 @@ #define DMON_ABRT(...) do { \ DMON_LOG (__VA_ARGS__); \ - if (kill (getpid (), SIGINT) < 0) \ + if (kill (getpid (), SIGINT) == -1) \ { \ DMON_LOG (_("Could not stop daemon properly: %s\n"), \ strerror (errno)); \ diff --git a/src/event.c b/src/event.c index f3a6298..7c371e4 100644 --- a/src/event.c +++ b/src/event.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/getstring.c b/src/getstring.c index 3e2b4da..8ea5df5 100644 --- a/src/getstring.c +++ b/src/getstring.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/hooks.c b/src/hooks.c index 1812e0d..f649076 100644 --- a/src/hooks.c +++ b/src/hooks.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/htable.h b/src/htable.h index 981003f..92be6e2 100644 --- a/src/htable.h +++ b/src/htable.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -214,7 +214,8 @@ static void ical_export_note(FILE *stream, char *name) asprintf(¬e_file, "%s/%s", path_notes, name); if (!(fp = fopen(note_file, "r")) || ungetc(getc(fp), fp) == EOF) { - fclose(fp); + if (fp) + fclose(fp); return; } string_init(¬e); @@ -520,6 +521,10 @@ ical_store_event(char *mesg, char *note, time_t day, time_t end, struct event *ev; struct recur_event *rev; + if (!mesg) + mesg = mem_strdup(_("(empty)")); + EXIT_IF(!mesg, _("ical_store_event: out of memory")); + /* * Repeating event. The end day is ignored, and the event becomes * one-day even if multi-day. @@ -572,6 +577,10 @@ ical_store_apoint(char *mesg, char *note, time_t start, long dur, struct recur_apoint *rapt; time_t day; + if (!mesg) + mesg = mem_strdup(_("(empty)")); + EXIT_IF(!mesg, _("ical_store_event: out of memory")); + if (has_alarm) state |= APOINT_NOTIFY; if (rpt) { @@ -682,7 +691,7 @@ static int ical_readline(FILE * fdi, char *buf, char *lstore, unsigned *ln) while (fgets(lstore, BUFSIZ, fdi) != NULL) { (*ln)++; if ((eol = strchr(lstore, '\n')) != NULL) { - if (*(eol - 1) == '\r') + if (strlen(lstore) > 1 && *(eol - 1) == '\r') *(eol - 1) = '\0'; else *eol = '\0'; @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -162,6 +162,47 @@ static struct keydef_s keydef[NBVKEYS] = { */ static char *keynames[KEY_MAX]; +/* Maps a key code to a custom key name */ +struct custom_keyname_s { + int keycode; + char* keyname; +}; + +#define CUSTOM_KEYS 26 + +/* + * Customized key names with calcurse short forms + */ +static struct custom_keyname_s custom_keynames[CUSTOM_KEYS] = { + { TAB, "TAB" }, + { RETURN, "RET" }, + { ESCAPE, "ESC" }, + { SPACE, "SPC" }, + { KEY_UP, "UP" }, + { KEY_DOWN, "DWN" }, + { KEY_LEFT, "LFT" }, + { KEY_RIGHT, "RGT" }, + { KEY_HOME, "HOM" }, + { KEY_END, "END" }, + { KEY_NPAGE, "PgD" }, + { KEY_PPAGE, "PgU" }, + { KEY_IC, "INS" }, + { KEY_DC, "DEL" }, + { KEY_F(1), "F1" }, + { KEY_F(2), "F2" }, + { KEY_F(3), "F3" }, + { KEY_F(4), "F4" }, + { KEY_F(5), "F5" }, + { KEY_F(6), "F6" }, + { KEY_F(7), "F7" }, + { KEY_F(8), "F8" }, + { KEY_F(9), "F9" }, + { KEY_F(10), "F10" }, + { KEY_F(11), "F11" }, + { KEY_F(12), "F12" }, +}; + + static void dump_intro(FILE * fd) { const char *intro = @@ -175,6 +216,16 @@ static void dump_intro(FILE * fd) fprintf(fd, "%s\n", intro); } +static bool is_customized(int c) { + int i; + + for (i = 0; i < CUSTOM_KEYS; i++) + if (c == custom_keynames[i].keycode) + return true; + + return false; +} + void keys_init(void) { int i; @@ -193,40 +244,20 @@ void keys_init(void) /* Insertion of ncurses names in the ASCII range ... */ for (i = 1; i < 128; i++) - if ((cp = keyname(i))) - keynames[i] = mem_strdup(cp); + if (!is_customized(i)) + if ((cp = keyname(i))) + keynames[i] = mem_strdup(cp); + /* ... and for the ncurses pseudo-characters. */ for (i = KEY_MIN; i < KEY_MAX; i++) - if ((cp = keyname(i))) - keynames[i] = mem_strdup(cp); + if (!is_customized(i)) + if ((cp = keyname(i))) + keynames[i] = mem_strdup(cp); /* Replace some with calcurse short forms. */ - keynames[TAB] = "TAB"; - keynames[RETURN] = "RET"; - keynames[ESCAPE] = "ESC"; - keynames[SPACE] = "SPC"; - keynames[KEY_UP] = "UP"; - keynames[KEY_DOWN] = "DWN"; - keynames[KEY_LEFT] = "LFT"; - keynames[KEY_RIGHT] = "RGT"; - keynames[KEY_HOME] = "HOM"; - keynames[KEY_END] = "END"; - keynames[KEY_NPAGE] = "PgD"; - keynames[KEY_PPAGE] = "PgU"; - keynames[KEY_IC] = "INS"; - keynames[KEY_DC] = "DEL"; - keynames[KEY_F(1)] = "F1"; - keynames[KEY_F(2)] = "F2"; - keynames[KEY_F(3)] = "F3"; - keynames[KEY_F(4)] = "F4"; - keynames[KEY_F(5)] = "F5"; - keynames[KEY_F(6)] = "F6"; - keynames[KEY_F(7)] = "F7"; - keynames[KEY_F(8)] = "F8"; - keynames[KEY_F(9)] = "F9"; - keynames[KEY_F(10)] = "F10"; - keynames[KEY_F(11)] = "F11"; - keynames[KEY_F(12)] = "F12"; + for (i = 0; i < CUSTOM_KEYS; i++) { + keynames[custom_keynames[i].keycode] = custom_keynames[i].keyname; + } } static void key_free(char *s) diff --git a/src/listbox.c b/src/listbox.c index 7ac7a26..d86f540 100644 --- a/src/listbox.c +++ b/src/listbox.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/llist.c b/src/llist.c index 9d4cd9c..d31f004 100644 --- a/src/llist.c +++ b/src/llist.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/llist.h b/src/llist.h index 386dcf3..0dd15bf 100644 --- a/src/llist.h +++ b/src/llist.h @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/llist_ts.h b/src/llist_ts.h index 048077a..a4b6184 100644 --- a/src/llist_ts.h +++ b/src/llist_ts.h @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/notify.c b/src/notify.c index a358bd5..6eda361 100644 --- a/src/notify.c +++ b/src/notify.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/queue.c b/src/queue.c index e6fce02..41cb69b 100644 --- a/src/queue.c +++ b/src/queue.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/recur.c b/src/recur.c index 64172ef..10523ad 100644 --- a/src/recur.c +++ b/src/recur.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -253,8 +253,13 @@ void recur_apoint_free(struct recur_apoint *rapt) mem_free(rapt->mesg); if (rapt->note) mem_free(rapt->note); - if (rapt->rpt) + if (rapt->rpt) { + recur_free_exc_list(&rapt->rpt->exc); + recur_free_int_list(&rapt->rpt->bywday); + recur_free_int_list(&rapt->rpt->bymonth); + recur_free_int_list(&rapt->rpt->bymonthday); mem_free(rapt->rpt); + } recur_free_exc_list(&rapt->exc); mem_free(rapt); } @@ -264,8 +269,13 @@ void recur_event_free(struct recur_event *rev) mem_free(rev->mesg); if (rev->note) mem_free(rev->note); - if (rev->rpt) + if (rev->rpt) { + recur_free_exc_list(&rev->rpt->exc); + recur_free_int_list(&rev->rpt->bywday); + recur_free_int_list(&rev->rpt->bymonth); + recur_free_int_list(&rev->rpt->bymonthday); mem_free(rev->rpt); + } recur_free_exc_list(&rev->exc); mem_free(rev); } @@ -1003,14 +1013,20 @@ static int find_occurrence(time_t start, long dur, struct rpt *rpt, llist_t *exc if (rpt->until && t >= NEXTDAY(rpt->until)) return 0; - /* Does it span the given day? */ - if (t + DUR(t) < day) + /* Does it span the given day? + * + * NOTE: An appointment ending at 00:00 is not considered to span the + * given day, unless the appointment is an appointment without + * specified end time, which is internally treated as appointment with + * duration 0. + */ + if (t + DUR(t) >= day || (t == day && dur == 0)) { + if (occurrence) + *occurrence = t; + return 1; + } else { return 0; - - if (occurrence) - *occurrence = t; - - return 1; + } } #undef DUR @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/strings.c b/src/strings.c index f05f78b..ed90bc7 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -85,6 +85,7 @@ int string_vcatf(struct string *sb, const char *format, va_list ap) ap2); } sb->len += n; + va_end(ap2); return n; } @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/ui-calendar.c b/src/ui-calendar.c index f386d58..c1719d8 100644 --- a/src/ui-calendar.c +++ b/src/ui-calendar.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -560,9 +560,8 @@ draw_weekly_view(struct scrollwin *sw, struct date *current_day) if (j != WEEKINDAYS - 1 && i != DAYSLICESNO - 1) { WINS_CALENDAR_LOCK; - mvwhline(sw->inner, OFFY + 2 + i, - OFFX + 3 + 4 * j, ACS_S9, - 2); + mvwaddstr(sw->inner, OFFY + 2 + i, + OFFX + 3 + 4 * j, "__"); WINS_CALENDAR_UNLOCK; } if (slices[i]) { @@ -593,9 +592,9 @@ draw_weekly_view(struct scrollwin *sw, struct date *current_day) /* Draw marks to indicate midday on the sides of the calendar. */ WINS_CALENDAR_LOCK; custom_apply_attr(sw->inner, ATTR_HIGHEST); - mvwhline(sw->inner, OFFY + 1 + DAYSLICESNO / 2, OFFX, ACS_S9, 1); - mvwhline(sw->inner, OFFY + 1 + DAYSLICESNO / 2, - OFFX + WCALWIDTH - 1, ACS_S9, 1); + mvwaddch(sw->inner, OFFY + 1 + DAYSLICESNO / 2, OFFX, '<'); + mvwaddch(sw->inner, OFFY + 1 + DAYSLICESNO / 2, + OFFX + WCALWIDTH - 1, '>'); custom_remove_attr(sw->inner, ATTR_HIGHEST); WINS_CALENDAR_UNLOCK; diff --git a/src/ui-day.c b/src/ui-day.c index 566ccd7..6a038fa 100644 --- a/src/ui-day.c +++ b/src/ui-day.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/ui-todo.c b/src/ui-todo.c index c715250..46933b3 100644 --- a/src/ui-todo.c +++ b/src/ui-todo.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -207,14 +207,16 @@ void ui_todo_draw(int n, WINDOW *win, int y, int hilt, void *cb_data) if (hilt) custom_apply_attr(win, ATTR_HIGHEST); - if (utf8_strwidth(todo->mesg) < width) { - mesg = todo->mesg; - } else { + mesg = todo->mesg; + if (mesg[0] == '\0') + mesg = EMPTY_EVENT_DESC_DEFAULT; + + if (utf8_strwidth(mesg) >= width) { width -= 3; - for (j = 0; todo->mesg[j] && width > 0; j++) { - if (!UTF8_ISCONT(todo->mesg[j])) - width -= utf8_width(&todo->mesg[j]); - buf[j] = todo->mesg[j]; + for (j = 0; mesg[j] && width > 0; j++) { + if (!UTF8_ISCONT(mesg[j])) + width -= utf8_width(&mesg[j]); + buf[j] = mesg[j]; } if (j) { buf[j - 1] = '.'; @@ -325,6 +327,11 @@ void ui_todo_popup_item(void) asprintf(¬epath, "%s%s", path_notes, item->note); fp = fopen(notepath, "r"); + if (fp == NULL) { + item_in_popup(NULL, NULL, item->mesg, _("TODO:")); + return; + } + note_read_contents(note, note_size, fp); fclose(fp); mem_free(notepath); @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/utils.c b/src/utils.c index 2640163..2d30bfc 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -175,8 +175,6 @@ void vars_init(void) ui_calendar_set_first_day_of_week(MONDAY); - wins_set_sbar_width(col * SBARMINWIDTH / 100); - /* Pad structure to scroll text inside the appointment panel */ apad.length = 1; apad.first_onscreen = 0; diff --git a/src/vector.c b/src/vector.c index 8ab57b0..796ef8e 100644 --- a/src/vector.c +++ b/src/vector.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/vector.h b/src/vector.h index 9610924..7648df2 100644 --- a/src/vector.h +++ b/src/vector.h @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2022 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without |