aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui-day.c
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2018-08-25 09:28:56 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2018-08-25 09:28:56 +0200
commita5febe2e22319d35ec65628c910c5210427ca943 (patch)
tree3f7a340378ddc48e0b6132b6eca58bedc19881e2 /src/ui-day.c
parent8466717f063a3c99297f24851c96a72c095b1739 (diff)
downloadcalcurse-a5febe2e22319d35ec65628c910c5210427ca943.tar.gz
calcurse-a5febe2e22319d35ec65628c910c5210427ca943.zip
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 <lfleischer@calcurse.org>
Diffstat (limited to 'src/ui-day.c')
-rw-r--r--src/ui-day.c9
1 files 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: