aboutsummaryrefslogtreecommitdiffstats
path: root/src/event.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-06-27 08:52:42 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-06-30 14:34:36 +0200
commit6907ae73e76d11c201ff237663af79b3bbfc5385 (patch)
tree3863be2f3c8b31f7a0c138debc3e5927f9b06acd /src/event.c
parentb230e2949ef888010c133e4b6f7690f2e1ed2c09 (diff)
downloadcalcurse-6907ae73e76d11c201ff237663af79b3bbfc5385.tar.gz
calcurse-6907ae73e76d11c201ff237663af79b3bbfc5385.zip
Revise cut/pasting
Instead of calling type-specific duplication handlers and inserting clones of the original items when pasting, save the generic day item and remove the actual item from the linked list, so that it can be inserted anywhere else later. The cut/paste buffer is moved to the interaction unit, item-specific cut operations are changed to remove the item from the linked list only instead of copying and freeing it. An item is only freed if another item is cut before the current cut/paste buffer is pasted. All paste operations are changed and reinsert the actual item instead of creating a clone. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/event.c')
-rw-r--r--src/event.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/event.c b/src/event.c
index 4f70391..d937a8b 100644
--- a/src/event.c
+++ b/src/event.c
@@ -167,10 +167,8 @@ void event_delete(struct event *ev, enum eraseflg flag)
erase_note(&ev->note);
break;
case ERASE_CUT:
- event_free_bkp();
- event_dup(ev, &bkp_cut_event);
- erase_note(&ev->note);
- /* FALLTHROUGH */
+ LLIST_REMOVE(&eventlist, i);
+ break;
default:
LLIST_REMOVE(&eventlist, i);
mem_free(ev->mesg);
@@ -179,9 +177,8 @@ void event_delete(struct event *ev, enum eraseflg flag)
}
}
-void event_paste_item(void)
+void event_paste_item(struct event *ev, long date)
{
- event_new(bkp_cut_event.mesg, bkp_cut_event.note,
- date2sec(*calendar_get_slctd_day(), 0, 0), bkp_cut_event.id);
- event_free_bkp();
+ ev->day = date;
+ LLIST_ADD_SORTED(&eventlist, ev, event_cmp_day);
}