aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2020-05-19 21:30:16 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2020-05-24 08:52:08 -0400
commit12514eab7f2d206e967d50d99039bf76f974ba2a (patch)
tree6c4007021156f5795806430d4649ed53bbc9fe96
parent92dc069fc4f80c0c2afd542beb012695ad702581 (diff)
downloadcalcurse-12514eab7f2d206e967d50d99039bf76f974ba2a.tar.gz
calcurse-12514eab7f2d206e967d50d99039bf76f974ba2a.zip
Let RETURN set frequency type to current value in repeat command UI
In addition, the prompt text is shortened. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
-rw-r--r--src/ui-day.c30
-rw-r--r--src/utils.c2
2 files changed, 19 insertions, 13 deletions
diff --git a/src/ui-day.c b/src/ui-day.c
index bd83cac..0d0e1fd 100644
--- a/src/ui-day.c
+++ b/src/ui-day.c
@@ -672,11 +672,11 @@ static int update_rept(time_t start, long dur, struct rpt **rpt, llist_t *exc,
LLIST_INIT(&nrpt.bymonthday);
/* Edit repetition type. */
- const char *msg_prefix = _("Repetition type:");
- const char *daily = _("(d)aily");
- const char *weekly = _("(w)eekly");
- const char *monthly = _("(m)onthly");
- const char *yearly = _("(y)early");
+ const char *msg_prefix = _("Base period:");
+ const char *daily = _("day");
+ const char *weekly = _("week");
+ const char *monthly = _("month");
+ const char *yearly = _("year");
const char *dwmy = _("[dwmy]");
/* Find the current repetition type. */
@@ -698,30 +698,34 @@ static int update_rept(time_t start, long dur, struct rpt **rpt, llist_t *exc,
/* New item. */
current = "";
}
- asprintf(&types, "%s %s, %s, %s, %s?",
+ asprintf(&types, "%s %s/%s/%s/%s?",
msg_prefix, daily, weekly, monthly, yearly);
if (current[0])
- asprintf(&types, "%s (now %s)", types, current);
+ asprintf(&types, "%s [%s]", types, current);
switch (status_ask_choice(types, dwmy, 4)) {
case 1:
- nrpt.type = 'D';
+ nrpt.type = recur_char2def('D');
break;
case 2:
- nrpt.type = 'W';
+ nrpt.type = recur_char2def('W');
break;
case 3:
- nrpt.type = 'M';
+ nrpt.type = recur_char2def('M');
break;
case 4:
- nrpt.type = 'Y';
+ nrpt.type = recur_char2def('Y');
break;
+ case -2: /* user typed RETURN */
+ if (current[0]) {
+ nrpt.type = (*rpt)->type;
+ break;
+ }
default:
goto cleanup;
}
- nrpt.type = recur_char2def(nrpt.type);
/* Edit frequency. */
- const char *msg_freq = _("Repetition frequency:");
+ const char *msg_freq = _("Frequency:");
const char *msg_inv_freq = _("Invalid frequency.");
do {
status_mesg(msg_freq, "");
diff --git a/src/utils.c b/src/utils.c
index 8c539c3..6f849ea 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -235,6 +235,8 @@ int status_ask_choice(const char *message, const char choice[],
return i + 1;
if (ch == ESCAPE)
return (-1);
+ if (ch == RETURN)
+ return (-2);
if (resize) {
resize = 0;
wins_reset();