Move updated cursor position to the end of whitespace on completion.

If there are extra spaces at the end of the text while doing
autocomplete matching, put the cursor at the end of the string
of spaces, rather than right after the (possibly failed)
completion.

Resolves issue #97.