VFPX / GoFish

GoFish is an advanced code search tool for fast searching and replacing of Visual FoxPro source code.
8 stars 7 forks source link

Toggle to disable Grep integration for those very rare occasions where it doesn't appear to be working correctly #273

Closed PGibsonCoUk closed 2 months ago

PGibsonCoUk commented 2 months ago

📝 Provide a description of the new feature

Perhaps more a discussion point, my intention is not to criticise the integration of Grep into GF, I am not trying to say that the introduction of Grep into the GF search tool is a bad thing but I do think that for a (very small??) subset of search expressions, the grep integration has had some problems where the previous versions of GF has performed those searches without issue.

Again, for the avoidance of doubt, I don't want this request to look like any slight on the development of the grep integration, it is clearly an enormous change to have the searches performed so differently and I appreciate that complexity and the effort required to do it.

In just the last few weeks I believe I've found three instances of where certain searches have failed where they should succeed. Two of those have been fixed already and with great response speed so I continue to thank the author for those super-fast fixes and all the improvements to GF. The third issue I have just raised a few minutes ago. So, the issues are being solved, but are there more out there, just undiscovered? Will users find more occurrences?

I fully understand the benefits of having grep do the heavy lifting wherever possible so the intention of this feature request is to perhaps raise the question of whether it is worth having a toggle in the options of GF, either in the Advanced Search Settings screen or in the general GF Options screen, which results in disabling the grep integration on demand. Perhaps something along the lines of a tickbox that says Use Grep for faster searches and users can untick if they ever encounter any problematic searches.

I would still encourage the Grep integration to be enabled by default, i.e. new installations of GF and upgrading GF from a previous version. Make GF default to having the grep integration turned on (as it does currently) in all appropriate circumstances but provide users with a way of temporarily switching it off so if a search attempt with grep has resulted in the wrong results the user can try again with grep forcibly switched off, with the search being performed the way GF used to perform the search before the Grep installation.

Having this be a toggle, which defaults to Grep being on, means users still get the benefits of using Grep but users who know that the search has incorrectly failed when using grep can still perform a (slower??) search without grep and then switch grep back on for other searches. In all three of my examples, I knew the searches had failed because the searches returned zero matches when I knew there would/should be results so it would have been good to be able to disable grep, repeat the search and see if that was indeed the cause.

We know the vast majority of searches are working fine with grep so it is just to support any that don't (yet?) without having to try to get a previous non-grep version of GF running, to perform that search. For my earlier two issue reports I was able to go back to a previous version of GF (v6) and perform the searches with that version in the short gap between finding the issue and the issue being resolved.

For this third issue, the most recent one, I attempted to do the same but I was getting error messages when launching the v6 GF so I've not been able to test or run that problematic search at all. This highlights how having the ability to switch grep off in v7 GF would allow me to run a problematic search without trying to launch v6 GF.

Jimrnelson commented 2 months ago

@PGibsonCoUk

  1. This option should not be necessary.
  2. But it is.
  3. And has been added in Version 7.1.17 - 2024-07-18
myearwood1 commented 2 months ago

I disagree with this "fix". Did you determine if there is a parameter in grep to support the search?

Jimrnelson commented 2 months ago

@myearwood1

I could not get grep to return any output when the first character is dash ("-"), whether enclosed in quotes or with a leading backslash.

My suspicion is that this may be occurring since all of the special parameters to grep begin with "-", although I have no way of confirming that.

If you can provide a simple way to handle this case, I would take a shot at implementing it.

myearwood1 commented 2 months ago

I'll get back to you on that. Can you show me what your grep command ends up like when you run it?

On Thu, Jul 18, 2024, 7:44 p.m. Jimrnelson @.***> wrote:

@myearwood1 https://github.com/myearwood1

I could not get grep to return any output when the first character is dash ("-"), whether enclosed in quotes or with a leading backslash.

My suspicion is that this may be occurring since all of the special parameters to grep begin with "-", although I have no way of confirming that.

If you can provide a simple way to handle this case, I would take a shot at implementing it.

— Reply to this email directly, view it on GitHub https://github.com/VFPX/GoFish/issues/273#issuecomment-2237782163, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABL36W7OYDAQZAXHXML4YKDZNBHO3AVCNFSM6AAAAABLCRN33SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZXG44DEMJWGM . You are receiving this because you were mentioned.Message ID: @.***>

Jimrnelson commented 2 months ago

@myearwood1

This is the entire line, very long as it tries to look for all possible file extensions (a topic we discussed a length previously)

"C:\VISUAL FOXPRO\VFPX\GOFISH\SOURCE\grep\grep.exe" -r -l -i -z -F --include=*.{SCT,SCt,ScT,Sct,sCT,sCt,scT,sct,VCT,VCt,VcT,Vct,vCT,vCt,vcT,vct,FRT,FRt,FrT,Frt,fRT,fRt,frT,frt,MNT,MNt,MnT,Mnt,mNT,mNt,mnT,mnt,LBT,LBt,LbT,Lbt,lBT,lBt,lbT,lbt,PJT,PJt,PjT,Pjt,pJT,pJt,pjT,pjt,PRG,PRg,PrG,Prg,pRG,pRg,prG,prg,TXT,TXt,TxT,Txt,tXT,tXt,txT,txt,INI,INi,InI,Ini,iNI,iNi,inI,ini,H,h,XML,XMl,XmL,Xml,xML,xMl,xmL,xml,HTM,HTm,HtM,Htm,hTM,hTm,htM,htm,HTML,HTMl,HTmL,HTml,HtML,HtMl,HtmL,Html,hTML,hTMl,hTmL,hTml,htML,htMl,htmL,html} "\-1" "c:/visual foxpro/programs/9.0" 
myearwood1 commented 2 months ago

Hello @Jimrnelson. The POSIX standards include using -- to separate arguments. It allows you to search even for -99. I think you should include the -- every time. Grep accepts it. C:\Gofish7\grep\grep.exe -r -l -i -z -F --include=*.{SCT,SCt,ScT,Sct,sCT,sCt,scT,sct,VCT,VCt,VcT,Vct,vCT,vCt,vcT,vct,FRT,FRt,FrT,Frt,fRT,fRt,frT,frt,MNT,MNt,MnT,Mnt,mNT,mNt,mnT,mnt,LBT,LBt,LbT,Lbt,lBT,lBt,lbT,lbt,PJT,PJt,PjT,Pjt,pJT,pJt,pjT,pjt,PRG,PRg,PrG,Prg,pRG,pRg,prG,prg,TXT,TXt,TxT,Txt,tXT,tXt,txT,txt,INI,INi,InI,Ini,iNI,iNi,inI,ini,H,h,XML,XMl,XmL,Xml,xML,xMl,xmL,xml,HTM,HTm,HtM,Htm,hTM,hTm,htM,htm,HTML,HTMl,HTmL,HTml,HtML,HtMl,HtmL,Html,hTML,hTMl,hTmL,hTml,htML,htMl,htmL,html} -- '-99'

Jimrnelson commented 2 months ago

Hey @myearwood1

Good one. Thanks

myearwood1 commented 1 month ago

Hi @Jimrnelson Did I miss the release where you used -- to allow searching for any text?

Jimrnelson commented 1 month ago

@myearwood1

I guess you did. It was part of 7.1.18.

myearwood1 commented 1 month ago

That's the version I'm using, so I did upgrade to get that fix, but forgot it's there. Thanks!!

Jimrnelson commented 1 month ago

@myearwood1

Your welcome.

And just now: Version 7.1.19 - 2024-08-08