aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui-day.c
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2019-06-03 18:43:23 -0400
committerLukas Fleischer <lfleischer@calcurse.org>2019-06-03 18:43:42 -0400
commit987fa9d3e5db8549612db7a8f1c05f7e7a19d224 (patch)
tree01334ac08b9049505c130c2a0f16439b1ec76c6b /src/ui-day.c
parente6099b2d59dfed9f7419f516e09952005f283dd5 (diff)
downloadcalcurse-987fa9d3e5db8549612db7a8f1c05f7e7a19d224.tar.gz
calcurse-987fa9d3e5db8549612db7a8f1c05f7e7a19d224.zip
Allow to omit end date in repetitions
Addresses GitHub issue #213. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/ui-day.c')
-rw-r--r--src/ui-day.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/ui-day.c b/src/ui-day.c
index 5907490..c90edc1 100644
--- a/src/ui-day.c
+++ b/src/ui-day.c
@@ -366,9 +366,11 @@ static void update_rept(struct rpt **rpt, const long start)
mem_free(timstr);
timstr = date_sec2date_str((*rpt)->until, DATEFMT(conf.input_datefmt));
status_mesg(msg_until_1, "");
- if (updatestring(win[STA].p, &timstr, 0, 1) !=
- GETSTRING_VALID) {
+ if (updatestring(win[STA].p, &timstr, 0, 1) == GETSTRING_ESC)
goto cleanup;
+ if (strcmp(timstr, "") == 0 || strcmp(timstr, "0") == 0) {
+ newuntil = 0;
+ break;
}
if (*(timstr + strlen(timstr) - 1) == '?') {
mem_free(outstr);
@@ -377,10 +379,6 @@ static void update_rept(struct rpt **rpt, const long start)
keys_wgetch(win[KEY].p);
continue;
}
- if (strcmp(timstr, "0") == 0) {
- newuntil = 0;
- break;
- }
if (*timstr == '+') {
unsigned days;
if (!parse_date_duration(timstr + 1, &days, start)) {
@@ -905,9 +903,12 @@ void ui_day_item_repeat(void)
char *outstr, *datestr;
for (;;) {
status_mesg(mesg_until_1, "");
- if (getstring(win[STA].p, user_input, BUFSIZ, 0, 1) !=
- GETSTRING_VALID)
+ if (getstring(win[STA].p, user_input, BUFSIZ, 0, 1) == GETSTRING_ESC)
goto cleanup;
+ if (strcmp(user_input, "") == 0 || strcmp(user_input, "0") == 0) {
+ until = 0;
+ break;
+ }
if (*user_input == '?') {
user_input[0] = '\0';
asprintf(&outstr, mesg_help_1, DATEFMT_DESC(conf.input_datefmt));
@@ -916,10 +917,6 @@ void ui_day_item_repeat(void)
wgetch(win[KEY].p);
continue;
}
- if (strcmp(user_input, "0") == 0) {
- until = 0;
- break;
- }
if (*user_input == '+') {
if (!parse_date_duration(user_input + 1, &days, p->start)) {
status_mesg(mesg_wrong_1, mesg_wrong_2);