Skip to content

Commit 3abf893

Browse files
authored
Merge 86ad592 into 2627312
2 parents 2627312 + 86ad592 commit 3abf893

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

source/cursorManager.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ class FindDialog(wx.Dialog):
3333
"""A dialog used to specify text to find in a cursor manager.
3434
"""
3535

36-
def __init__(self, parent, cursorManager, text, caseSensitivity):
36+
def __init__(self, parent, cursorManager, text, caseSensitivity, reverse=False):
3737
# Translators: Title of a dialog to find text.
3838
super(FindDialog, self).__init__(parent, wx.ID_ANY, _("Find"))
3939
# Have a copy of the active cursor manager, as this is needed later for finding text.
4040
self.activeCursorManager = cursorManager
41+
self.reverse = reverse
4142
mainSizer = wx.BoxSizer(wx.VERTICAL)
4243
sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL)
4344
# Translators: Dialog text for NvDA's find command.
@@ -61,7 +62,7 @@ def onOk(self, evt):
6162
caseSensitive = self.caseSensitiveCheckBox.GetValue()
6263
# We must use core.callLater rather than wx.CallLater to ensure that the callback runs within NVDA's core pump.
6364
# If it didn't, and it directly or indirectly called wx.Yield, it could start executing NVDA's core pump from within the yield, causing recursion.
64-
core.callLater(100, self.activeCursorManager.doFindText, text, caseSensitive=caseSensitive)
65+
core.callLater(100, self.activeCursorManager.doFindText, text, caseSensitive=caseSensitive, reverse=self.reverse)
6566
self.Destroy()
6667

6768
def onCancel(self, evt):
@@ -164,11 +165,11 @@ def doFindText(self, text, reverse=False, caseSensitive=False, willSayAllResume=
164165
CursorManager._lastFindText=text
165166
CursorManager._lastCaseSensitivity=caseSensitive
166167

167-
def script_find(self,gesture):
168+
def script_find(self,gesture, reverse=False):
168169
# #8566: We need this to be a modal dialog, but it mustn't block this script.
169170
def run():
170171
gui.mainFrame.prePopup()
171-
d = FindDialog(gui.mainFrame, self, self._lastFindText, self._lastCaseSensitivity)
172+
d = FindDialog(gui.mainFrame, self, self._lastFindText, self._lastCaseSensitivity, reverse)
172173
d.ShowModal()
173174
gui.mainFrame.postPopup()
174175
wx.CallAfter(run)
@@ -203,7 +204,7 @@ def script_findNext(self,gesture):
203204
)
204205
def script_findPrevious(self,gesture):
205206
if not self._lastFindText:
206-
self.script_find(gesture)
207+
self.script_find(gesture, reverse=True)
207208
return
208209
self.doFindText(
209210
self._lastFindText,

0 commit comments

Comments
 (0)