PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: WinFBE 1.9.8 - Find And Replace  (Read 351 times)

SeaVipe

  • Senior Member
  • ***
  • Posts: 251
  • Windows 10
WinFBE 1.9.8 - Find And Replace
« on: November 14, 2019, 05:14:47 PM »

Hi Paul,


I'm in the middle of converting a large FireFly project to WinWBE for testing. In the attached screenshot you can see I was attempting to comment out FF_ by finding and replacing FF_ with ''''FF_. I selected 'Replace All' but only the first FF_ was replaced. WinFBE inserted multiple groups of four apostrophes (single quotes) in front of the first FF_ (which took some minutes on my machine). This action is repeatable when 3 or more apostrophes are included in the replacement text (leading and trailing spaces included ' ''' ').
Find and Replace works properly on a single occurrence of FF_ with the multiple apostrophe as the replacement text (find next and replace will work all the way through the document)
Logged
Clive Richey
There is nothing government can give you that it hasn't already taken from you in the first place. Winston Churchill

raymw

  • Senior Member
  • ***
  • Posts: 364
Re: WinFBE 1.9.8 - Find And Replace
« Reply #1 on: November 14, 2019, 06:31:08 PM »

Hi Clive,
It's a problem with any replace, where you insert characters before the letters you are replacing, afaik. I found similar when I converted my c# program., mentioned it somewhere here. I think the process is, it finds the first occurrence of ff in your example, then replaces it with ''''ff, then the character count is such that it finds ff again, and repeats the replace and so on. You could work round it by replacing ff with ''''xx say, then replace the xx with ff  - it won't find the ff in the replacement (chose something other than xx if you may have that as actual characters). hth

edit - it was here https://www.planetsquires.com/protect/forum/index.php?topic=4329.0 first post
« Last Edit: November 14, 2019, 06:37:40 PM by raymw »
Logged

SeaVipe

  • Senior Member
  • ***
  • Posts: 251
  • Windows 10
Re: WinFBE 1.9.8 - Find And Replace
« Reply #2 on: November 14, 2019, 06:40:18 PM »

Thanks, Ray, though it's odd that Replace only exhibits that behaviour not with 1 or 2 but 3 ''' or more. You'd think after the first replacement Find would not search its own replacement string... I eventually replaced all FF_ with ' FIX -> FF_
Logged
Clive Richey
There is nothing government can give you that it hasn't already taken from you in the first place. Winston Churchill

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8941
  • Windows 10
    • PlanetSquires Software
Re: WinFBE 1.9.8 - Find And Replace
« Reply #3 on: November 16, 2019, 11:17:48 AM »

Thanks guys.... I am testing this and will fix once I figure out the problem with the underlying find/replace algorithm.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8941
  • Windows 10
    • PlanetSquires Software
Re: WinFBE 1.9.8 - Find And Replace
« Reply #4 on: November 16, 2019, 11:37:22 AM »

Okay, that was easier to fix than I thought.

I was incrementing the starting position by the length of the Find phrase rather than the length of the Replace phrase.

         startPos = r + len(txtReplace)  'len(txtFind)
         ' Adjust the searching positions
         SciExec( hEdit, SCI_SETTARGETSTART, startPos, 0)
         SciExec( hEdit, SCI_SETTARGETEND, endPos, 0)

Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer