Improve handling of cursor_start and cursor_end for QtConsole completions.

This partially addresses #6690.

Also, a few trailing whitespaces that my editor removed...
It is a quirk of Qt in Python.  When we ask for `self._control.textCursor()`, we get a *copy* of the text cursor.  If we want to affect the original cursor, we have to then use `self._control.setTextCursor(my_copy_of_cursor)`.  I do this so that in [console_widget._complete_with_items](https://github.com/ipython/ipython/blob/master/IPython/qt/console/console_widget.py#L986), when we ask for `self._control.textCursor().position()`, we get the updated cursor position.