Jump to content
Sign in to follow this  
MarkShark

SearchBuf issue since Delphi 11.2 fix for wholeword searching.

Recommended Posts

As of Delphi 11.2 they fixed the wholeword option handing (https://quality.embarcadero.com/browse/RSP-20731) however they changed the way that SelStart works when searching backwards (its' now -1 based instead of zero based..)  To fix it to match the earlier behavior you have to do something like:

 

  if soDown in StringOptions then
    Result := SearchBuf(Buf, BufLen, SelStart, SelLength, SearchString, StringOptions)
  else
    Result := SearchBuf(Buf, BufLen, SelStart - 1, SelLength, SearchString, StringOptions);
 

Basically, when searching backwards a SelStart of zero means to start the search at char position 1.  Maybe there's some reason to make it work that way, but it's a change from earlier versions where searching forwards and backwards used the easier to understand base of zero as the start of the search.  I haven't created a bug report for this as I had some problems with attempting to do it recently.   Also is there a way to do an ifdef specific to 11.2?

 

  • Thanks 1

Share this post


Link to post
35 minutes ago, MarkShark said:

Also is there a way to do an ifdef specific to 11.2?

See 

 

  • Like 1

Share this post


Link to post

Thanks!  Is using Searchbuf (unfortunately with the $if to fix this issue) ok to use as a solution to the SynEdit search engine issue I've been working on?  Otherwise, we'd need a reverse version of the current "Next" function which looks like it might be a Boyer-Moore implementation?

Share this post


Link to post
57 minutes ago, MarkShark said:

Thanks!  Is using Searchbuf (unfortunately with the $if to fix this issue) ok to use as a solution to the SynEdit search engine issue I've been working on?  Otherwise, we'd need a reverse version of the current "Next" function which looks like it might be a Boyer-Moore implementation?

Please open an issue and describe the problem.  Using SearchBuf should be OK.

Share this post


Link to post

Issue #78 and my pull request to start to fix it is #79.  I have it fixed and tested, just needed that last bit of info about the 11.2 problem.  Works great in my testing so far.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×