Fix copy/paste (clear selection and positioning of the cursor)

Signed-off-by: Thibaud Arnault <thyb@oauth.io>