Override editwindow SetSelection as a temporary patch

Better to override editwindow (a common parent of shell and sliceshell)
This commit is contained in:
komoto
2022-05-20 13:20:48 +09:00
parent 85466c87b8
commit de5abf4219

View File

@@ -297,3 +297,12 @@ class EditWindow(stc.StyledTextCtrl):
# show and select the found text
self.ShowPosition(loc)
self.SetSelection(loc, loc + len(findstring))
def SetSelection(self, from_, to_):
"""Selects the text starting at the first position up to
(but not including) the character at the last position.
"""
# (override) Patch for miss-insertion position when from_ > to_.
# Note: This is needed until the stc SetSelection bug is fixed.
self.SetAnchor(from_)
self.SetCurrentPos(to_)