Workaround for issue #1474

This is a workaround for the issue #1474 and underlying webkit bug.
The problem seems to be happenning in webkit if the selection spans to the very end of the textarea content, so the workaround adds a trailing character to the textarea.

P.S. This is the corrected version of the pull request https://github.com/marijnh/CodeMirror/pull/1683