244 |
244 |
245 idx = -1 |
245 idx = -1 |
246 if len(ba) > 0: |
246 if len(ba) > 0: |
247 startIndex = self.__editor.cursorPosition() // 2 |
247 startIndex = self.__editor.cursorPosition() // 2 |
248 if prev: |
248 if prev: |
249 if self.__editor.hasSelection() and \ |
249 if ( |
250 startIndex == self.__editor.getSelectionEnd(): |
250 self.__editor.hasSelection() and |
|
251 startIndex == self.__editor.getSelectionEnd() |
|
252 ): |
251 # skip to the selection start |
253 # skip to the selection start |
252 startIndex = self.__editor.getSelectionBegin() |
254 startIndex = self.__editor.getSelectionBegin() |
253 idx = self.__editor.lastIndexOf(ba, startIndex) |
255 idx = self.__editor.lastIndexOf(ba, startIndex) |
254 else: |
256 else: |
255 if self.__editor.hasSelection() and \ |
257 if ( |
256 startIndex == self.__editor.getSelectionBegin() - 1: |
258 self.__editor.hasSelection() and |
|
259 startIndex == self.__editor.getSelectionBegin() - 1 |
|
260 ): |
257 # skip to the selection end |
261 # skip to the selection end |
258 startIndex = self.__editor.getSelectionEnd() |
262 startIndex = self.__editor.getSelectionEnd() |
259 idx = self.__editor.indexOf(ba, startIndex) |
263 idx = self.__editor.indexOf(ba, startIndex) |
260 |
264 |
261 if idx >= 0: |
265 if idx >= 0: |
334 |
338 |
335 @param searchNext flag indicating to search for the next occurrence |
339 @param searchNext flag indicating to search for the next occurrence |
336 @type bool |
340 @type bool |
337 """ |
341 """ |
338 # Check enabled status due to dual purpose usage of this method |
342 # Check enabled status due to dual purpose usage of this method |
339 if not self.__ui.replaceButton.isEnabled() and \ |
343 if ( |
340 not self.__ui.replaceSearchButton.isEnabled(): |
344 not self.__ui.replaceButton.isEnabled() and |
|
345 not self.__ui.replaceSearchButton.isEnabled() |
|
346 ): |
341 return |
347 return |
342 |
348 |
343 fba, ftxt = self.__getContent(False) |
349 fba, ftxt = self.__getContent(False) |
344 rba, rtxt = self.__getContent(True) |
350 rba, rtxt = self.__getContent(True) |
345 |
351 |