From a5febe2e22319d35ec65628c910c5210427ca943 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sat, 25 Aug 2018 09:28:56 +0200 Subject: Make editing of punctual appointments more intuitive When editing the start time, move the item instead of keeping the previous start time as end time. When editing the end time, start with an empty end time instead of the previous start time. Fixes GitHub issue #89. Signed-off-by: Lukas Fleischer --- src/ui-day.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ui-day.c b/src/ui-day.c index 9ce7ddd..f1abf09 100644 --- a/src/ui-day.c +++ b/src/ui-day.c @@ -83,7 +83,7 @@ static int day_edit_time(int time) /* Request the user to enter a new time or duration. */ static int day_edit_duration(int start, int dur, unsigned *new_duration) { - char *timestr = date_sec2date_str(start + dur, "%H:%M"); + char *timestr = mem_strdup(""); const char *msg_time = _("Enter end time ([hh:mm], [hhmm]) or duration ([+hh:mm], [+xxxdxxhxxm]):"); const char *enter_str = _("Press [Enter] to continue"); @@ -91,6 +91,9 @@ static int day_edit_duration(int start, int dur, unsigned *new_duration) _("You entered an invalid time, should be [hh:mm] or [hhmm]"); long end; + if (dur > 0) + timestr = date_sec2date_str(start + dur, "%H:%M"); + for (;;) { int ret; @@ -380,7 +383,7 @@ void ui_day_item_edit(void) (_("Edit: "), choice_recur_appt, 5)) { case 1: need_check_notify = 1; - update_start_time(&ra->start, &ra->dur, 1); + update_start_time(&ra->start, &ra->dur, ra->dur > 0); io_set_modified(); break; case 2: @@ -420,7 +423,7 @@ void ui_day_item_edit(void) (_("Edit: "), choice_appt, 4)) { case 1: need_check_notify = 1; - update_start_time(&a->start, &a->dur, 1); + update_start_time(&a->start, &a->dur, a->dur > 0); io_set_modified(); break; case 2: -- cgit v1.2.3-70-g09d2