--- a/application/main.c Sat Apr 05 13:02:37 2014 +0200 +++ b/application/main.c Sat Apr 05 15:53:41 2014 +0200 @@ -110,10 +110,23 @@ void action_copy(UiEvent *event, void *data) { printf("copy\n"); + TestWindowData *wd = event->window; + int begin; + int end; + wd->text.selection(&wd->text, &begin, &end); + char *selection = wd->text.getsubstr(&wd->text, begin, end); + ui_clipboard_set(selection); } void action_paste(UiEvent *event, void *data) { printf("paste\n"); + TestWindowData *wd = event->window; + char *str = ui_clipboard_get(); + if(str) { + int pos = wd->text.position(&wd->text); + wd->text.insert(&wd->text, pos, str); + free(str); + } } void action_delete(UiEvent *event, void *data) {