summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-07-04 09:43:30 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-07-06 01:59:01 +0200
commita3cf63b3748c5f42214d648f003933d5597a3a8d (patch)
tree92680262e35c4fbada4690ee94903ab111e900f4
parenta9efce76f30a86faf5084fc06fe252491fadb467 (diff)
downloadcalcurse-a3cf63b3748c5f42214d648f003933d5597a3a8d.tar.gz
calcurse-a3cf63b3748c5f42214d648f003933d5597a3a8d.zip
Add interact_day_item_copy()
This can be used to copy an item, so that it can be pasted somewhere else later. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r--src/calcurse.h1
-rw-r--r--src/interaction.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/src/calcurse.h b/src/calcurse.h
index cefc850..c2f7b2b 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -723,6 +723,7 @@ void interact_day_item_pipe(void);
void interact_day_item_repeat(void);
void interact_day_item_cut_free();
void interact_day_item_cut(unsigned *, unsigned *);
+void interact_day_item_copy(unsigned *, unsigned *);
void interact_day_item_paste(unsigned *, unsigned *);
void interact_todo_add(void);
void interact_todo_delete(void);
diff --git a/src/interaction.c b/src/interaction.c
index d3f2cef..abe261d 100644
--- a/src/interaction.c
+++ b/src/interaction.c
@@ -926,6 +926,18 @@ void interact_day_item_cut(unsigned *nb_events, unsigned *nb_apoints)
apoint_hilt_set(0);
}
+/* Copy an item, so that it can be pasted somewhere else later. */
+void interact_day_item_copy(unsigned *nb_events, unsigned *nb_apoints)
+{
+ const int NBITEMS = *nb_apoints + *nb_events;
+
+ if (NBITEMS == 0)
+ return;
+
+ interact_day_item_cut_free();
+ day_item_fork(day_get_item(apoint_hilt()), &day_cut);
+}
+
/* Paste a previously cut item. */
void interact_day_item_paste(unsigned *nb_events, unsigned *nb_apoints)
{