From 217e66729a249a638863a9cc2ff93b8368cd6094 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 1 Feb 2013 18:14:32 +0100 Subject: Skip duration update if the prompt is canceled Do not update an appointment's duration if the user cancels the prompt at day_edit_duration(). Note that day_edit_duration() does not touch the buffer if the prompt was canceled or an invalid value was entered, resulting in the buffer variable being uninitialized in these cases. Signed-off-by: Lukas Fleischer --- src/interaction.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/interaction.c b/src/interaction.c index d048239..25b2806 100644 --- a/src/interaction.c +++ b/src/interaction.c @@ -126,8 +126,8 @@ static void update_duration(long *start, long *dur) { unsigned newdur; - day_edit_duration(*start, *dur, &newdur); - *dur = newdur; + if (day_edit_duration(*start, *dur, &newdur)) + *dur = newdur; } static void update_desc(char **desc) -- cgit v1.2.3-70-g09d2 From e27cf190d05e6b07cba1dfe47dd2426a3c167056 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 1 Feb 2013 18:24:02 +0100 Subject: Skip start time update if prompt is canceled See commit 217e66729a249a638863a9cc2ff93b8368cd6094 for details. Signed-off-by: Lukas Fleischer --- src/interaction.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/interaction.c b/src/interaction.c index 25b2806..c313ce9 100644 --- a/src/interaction.c +++ b/src/interaction.c @@ -107,7 +107,8 @@ static void update_start_time(long *start, long *dur) const char *msg_enter = _("Press [Enter] to continue"); do { - day_edit_time(*start, &hr, &mn); + if (!day_edit_time(*start, &hr, &mn)) + break; newtime = update_time_in_date(*start, hr, mn); if (newtime < *start + *dur) { *dur -= (newtime - *start); -- cgit v1.2.3-70-g09d2 From 93767ce29c6ea41c40808276aa0ae9fc60d5eca5 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 1 Feb 2013 18:28:07 +0100 Subject: Properly skip spaces after exception list Skip whitespace after obtaining the list of exceptions instead of skipping the next character unconditionally. Signed-off-by: Lukas Fleischer --- src/io.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/io.c b/src/io.c index 2ae19d0..ff8d1ea 100644 --- a/src/io.c +++ b/src/io.c @@ -526,7 +526,8 @@ void io_load_app(void) if (c == '!') { ungetc(c, data_file); recur_exc_scan(&exc, data_file); - c = getc(data_file); + while ((c = getc(data_file)) == ' ') ; + ungetc(c, data_file); } else if (c == '}') { while ((c = getc(data_file)) == ' ') ; ungetc(c, data_file); @@ -535,7 +536,8 @@ void io_load_app(void) } else if (c == '!') { /* endless item with exceptions */ ungetc(c, data_file); recur_exc_scan(&exc, data_file); - c = getc(data_file); + while ((c = getc(data_file)) == ' ') ; + ungetc(c, data_file); until.tm_year = 0; } else { io_load_error(path_apts, line, -- cgit v1.2.3-70-g09d2