Fix for Editor copy without selection and cuting something when caret is at the last position in the document

From https://github.com/energia/Energia/issues/195 and
https://github.com/energia/Energia/issues/194