mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-08 04:50:07 +01:00
Merge pull request #2158 from komoto48g/shell-stc
Fix issue #2157: wx.py.shell.Shell.OnHistorySearch
This commit is contained in:
@@ -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_)
|
||||
|
||||
@@ -854,8 +854,8 @@ class Shell(editwindow.EditWindow):
|
||||
or (self.historyIndex >= len(self.history)-2):
|
||||
searchOrder = range(len(self.history))
|
||||
else:
|
||||
searchOrder = range(self.historyIndex+1, len(self.history)) + \
|
||||
range(self.historyIndex)
|
||||
ls = list(range(len(self.history)))
|
||||
searchOrder = ls[self.historyIndex+1:] + ls[:self.historyIndex]
|
||||
for i in searchOrder:
|
||||
command = self.history[i]
|
||||
if command[:len(searchText)] == searchText:
|
||||
|
||||
@@ -2270,8 +2270,8 @@ class SlicesShell(editwindow.EditWindow):
|
||||
or (self.historyIndex >= len(self.history)-2):
|
||||
searchOrder = range(len(self.history))
|
||||
else:
|
||||
searchOrder = range(self.historyIndex+1, len(self.history)) + \
|
||||
range(self.historyIndex)
|
||||
ls = list(range(len(self.history)))
|
||||
searchOrder = ls[self.historyIndex+1:] + ls[:self.historyIndex]
|
||||
for i in searchOrder:
|
||||
command = self.history[i]
|
||||
if command[:len(searchText)] == searchText:
|
||||
|
||||
Reference in New Issue
Block a user