New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-line "Find in Files" searching #2322
Comments
Glib contains regexen support and directory reading and file reading, so it would be a mere matter of programming to implement the search in Geany and do away with grep (which isn't available on windows by default, and isn't neccessarily GNU grep on BSDs etc.). Just "somebody" has to do it :) |
I think you could already set pcregrep as the grep tool in Preferences. Then in the other options entry [of find in files] you can add any necessary flags for multi-line matching. |
That would basically have to reimplement grep. People can pass custom options, we don't know which extra ones they use. I don't think this is an effective use of time.
I think it's bundled with the installer.
Is there a problem on BSD with any of the wrapped grep options? |
Thanks, I wasn't aware of the option. It almost works, but I had to tweak the code: The only other remark is the exclude-dir and exclude and include syntax works via regexps not globbing (regexps is nicer IMO). So the user will need to change how they fill in the custom files filter, and their extra options. As for whether we should use grep... I can see both sides of it, especially knowing I now can use pcregrep. I don't see why it would be hard to do this internally though, given that Geany already implements regexp searching of files. What's the big difference if it can do what it already does enumerating over a project directory? Possibly people are using some exotic options. For me, all I do is specify what directories/files to exclude, which already is a project property. |
Ok, thanks. Looks good, I didn't realize pcregrep doesn't have an -E option.
Hmm, it's frustrating that they repurposed those options, it's so close to being a drop in replacement. (They could have added regexp file matching with different option names). We could just disable the file filter row when pcregrep is set.
It doesn't. Geany loads files into scintilla. It would be simple to implement trivial file searching, but grep and pcregrep have many optimisations vs simple linear search and reading entire files into buffers.
Yes, I expect we would struggle with this. For example, pcregrep has an option to treat lone CR or LF as a new line. |
Thanks. To clarify, I don't consider the difference in EDIT: EDIT: |
I'm now working on this, starting from your commits. I think -M shouldn't be the only regex option for pcre, because sometimes you don't want
It is, because of the tooltips in the FIF and Project dialogs' file patterns field -
Without the recursive option, Geany actually passes the filenames to grep itself. That can be sorted, we could implement recursive filenames too. |
Implementation in #2364. |
It actually is sorted already, so just the recursive option sorting needs implementing (which is currently handled by grep). |
Cool :). A couple of notes:
|
It would be very useful to be able to search across multiple lines in "Find in Files". This doesn't work using patterns (\n) or by pasting in the line break character.
I realize this is all because
grep
doesn't really support multi-line searches, and it would be difficult to implement this request.It might be possible to add support for
pcregrep
to do what we need, with Geany complaining if you are searching for a linebreak-containing string and there being nopcregrep
installed.Or, we could dump grep and move find in files internally, using the same engine as the current Find feature.
The text was updated successfully, but these errors were encountered: