[QScintilla] Setting insert point to start of selection

Phil Thompson phil at riverbankcomputing.com
Thu Oct 9 15:10:39 BST 2008


On Thu, 9 Oct 2008 07:54:08 -0500, "Edward K. Ream" <edreamleo at gmail.com>
wrote:
> Hello all,
> 
> I am moving the Leo editor from Tk to PyQt.  In most respects PyQt
> appears much better than tkinter.
> 
> However, a seemingly small hole in QScintilla interface could cause
> big problems: there seems to be no way to select text with the
> insertion point at the *start* of the selection range.
> 
> Indeed, the setSelection always puts the insert point at the end of
> the selection.  A prior call to setCursorPosition has no effect, and a
> later call to setCursorPosition clears the selection :-(
> 
> I have tried reversing the arguments to setSelection with no joy.  I
> see nothing akin to exchange-point-and-mark.
> 
> This is a deal breaker for Leo.  Can you suggest something?  Thanks.

If you setCursorPosition() and then use SCI_SETANCHOR (using a call to
SendScintilla()) you should (according to the Scintilla docs) get what you
want.

If this works for you then I can change the implementation of
setSelection() to do the same thing and then reversing the arguments, as
you tried, would work.

Phil


More information about the QScintilla mailing list