summaryrefslogtreecommitdiff
path: root/src/ui-day.c
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2016-02-16 07:48:25 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2016-02-16 07:53:12 +0100
commit65b699f7708eba7c504d8593be749fa4e0cd57c3 (patch)
tree37df200796a493dcd6806b28522721e7c01240f3 /src/ui-day.c
parentfeb059e8cff5fd1057faf88caa127623e35775d2 (diff)
downloadcalcurse-65b699f7708eba7c504d8593be749fa4e0cd57c3.zip
Make automatic selection of appointments/events smarter
Keep item selection when an item is moved (e.g. by changing the start time or description). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/ui-day.c')
-rw-r--r--src/ui-day.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ui-day.c b/src/ui-day.c
index 84beb77..4b004f7 100644
--- a/src/ui-day.c
+++ b/src/ui-day.c
@@ -38,6 +38,21 @@
struct day_item day_cut[38] = { {0, 0, {NULL}} };
+struct day_item *ui_day_selitem(void)
+{
+ if (day_item_count(0) <= 0)
+ return NULL;
+
+ return day_get_item(listbox_get_sel(&lb_apt));
+}
+
+void ui_day_set_selitem(struct day_item *day)
+{
+ int n = day_get_position(day);
+ if (n >= 0)
+ listbox_set_sel(&lb_apt, n);
+}
+
/* Request the user to enter a new time. */
static int day_edit_time(int time, unsigned *new_hour,
unsigned *new_minute)