corrected paste sometimes leaving selection on screen

while the selection appeared on the screen, the selection was not
actually present and the document was correctly updated

the paste function was reimplemented with a clipboard mode argument,
which first clears the selection with a temporary text cursor, then the
clipboard text is inserted with the origin text cursor

for selection (middle-click) paste, the reimplemented paste function is
called with the selection clipboard mode