#6 Click in selected text to clear selection

closed
nobody
None
5
2004-09-13
2004-09-12
No

When a piece of text is selected in the editor and you
then click the left mouse button inside the selected
text, the selection is not cleared. I would like to be
able to set the cursor position and clear the current
selection with just one mouse click.

Is there currently an option to enable this functionality?

If not, please could such an option be added?

Discussion

  • Franz Steinhaeusler

    Logged In: YES
    user_id=772872

    good point, this has annoyed me often, too.
    I looked in pype (same behaviour)
    wxPython Demo it works, also in scite.
    I didn't found out, why in wxPython Demo this work.

    So I played around
    and came to following small patch:
    (Luckily i found the two functions Position from point and
    event.GetPostion)

    in class DrText:

    self.Bind(wx.EVT_LEFT_DOWN, self.OnLDown)

    def OnLDown (self, event):
    beg, end = self.GetSelection ()
    #inselection?
    if beg != end:
    i = self.PositionFromPoint (event.GetPosition())
    self.SetSelection(i, i)
    #default behaviour
    event.Skip()

    HTH

     
  • Daniel Pozmanter

    Logged In: YES
    user_id=796750

    Trust Franz to find a fix so quickly!

    I found a fix as well, and it is in 3.4.7, which I hope to
    release tonight.

    Mine is somewhat different:

    def OnLeftDown(self, event):
    pos = self.PositionFromPoint(wx.Point(event.GetX(),
    event.GetY()))
    s, e = self.GetSelection()
    if (pos > s) and (pos < e):
    self.SetSelection(pos, pos)
    return
    event.Skip()

    They both seem to work precisely the same.

     
  • Daniel Pozmanter

    Logged In: YES
    user_id=796750

    I am closing this. 3.4.7 will be out soonish.

     
  • Daniel Pozmanter

    • status: open --> closed
     
  • Richard Townsend

    Logged In: YES
    user_id=200117

    Thank you for fixing this.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks