HexEdit/HexEditSearchReplaceWidget.py

changeset 4654
9dafe6905667
parent 4653
e8b51747c48e
child 4656
ec546bd4ec56
equal deleted inserted replaced
4653:e8b51747c48e 4654:9dafe6905667
241 # Check enabled status due to dual purpose usage of this method 241 # Check enabled status due to dual purpose usage of this method
242 if not self.__ui.replaceButton.isEnabled() and \ 242 if not self.__ui.replaceButton.isEnabled() and \
243 not self.__ui.replaceSearchButton.isEnabled(): 243 not self.__ui.replaceSearchButton.isEnabled():
244 return 244 return
245 245
246 fba, ftxt = self.__getContent(False)
246 rba, rtxt = self.__getContent(True) 247 rba, rtxt = self.__getContent(True)
247 248
248 ok = False 249 ok = False
249 if self.__editor.hasSelection(): 250 if self.__editor.hasSelection():
250 # we did a successful search before 251 # we did a successful search before
251 startIdx = self.__editor.getSelectionBegin() 252 startIdx = self.__editor.getSelectionBegin()
252 self.__editor.replaceByteArray(startIdx, len(rba), rba) 253 self.__editor.replaceByteArray(startIdx, len(fba), rba)
253 254
254 if searchNext: 255 if searchNext:
255 ok = self.findPrevNext(self.__findBackwards) 256 ok = self.findPrevNext(self.__findBackwards)
256 257
257 if not ok: 258 if not ok:
272 273
273 idx = 0 274 idx = 0
274 while idx >= 0: 275 while idx >= 0:
275 idx = self.__editor.indexOf(fba, idx) 276 idx = self.__editor.indexOf(fba, idx)
276 if idx >= 0: 277 if idx >= 0:
277 self.__editor.replaceByteArray(idx, len(rba), rba) 278 self.__editor.replaceByteArray(idx, len(fba), rba)
278 idx += len(rba) 279 idx += len(rba)
279 replacements += 1 280 replacements += 1
280 281
281 if replacements: 282 if replacements:
282 E5MessageBox.information( 283 E5MessageBox.information(

eric ide

mercurial