aboutsummaryrefslogtreecommitdiffstats
path: root/src/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/day.c
parentfeb059e8cff5fd1057faf88caa127623e35775d2 (diff)
downloadcalcurse-65b699f7708eba7c504d8593be749fa4e0cd57c3.tar.gz
calcurse-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/day.c')
-rw-r--r--src/day.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/day.c b/src/day.c
index 2a98706..fa59abb 100644
--- a/src/day.c
+++ b/src/day.c
@@ -700,6 +700,21 @@ int day_paste_item(struct day_item *p, long date)
return p->type;
}
+/* Returns the position corresponding to a given item. */
+int day_get_position(struct day_item *needle)
+{
+ int n = 0;
+
+ VECTOR_FOREACH(&day_items, n) {
+ struct day_item *p = VECTOR_NTH(&day_items, n);
+ /* Compare pointers. */
+ if (p->item.ev == needle->item.ev)
+ return n;
+ }
+
+ return -1;
+}
+
/* Returns a structure containing the selected item. */
struct day_item *day_get_item(int item_number)
{