Red Hat Bugzilla – Bug 149927
Incremental find does not work in Eclipse
Last modified: 2007-11-30 17:11:01 EST
Description of problem:
Incremental find does not work when editing files in Eclipse.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Open a file in the editor.
2. Select Edit/Incremental Find Next (or press Ctrl-J).
3. Type the text to search for.
The mode and search string should be shown in the status bar. Also, the text
should be incrementally searched for.
It the gnu.gcj.precompiled.db.path argument is removed from /usr/bin/eclipse,
the status bar does update, but Eclipse is still failing to find any text.
When using java-1.5.0-sun, it works fine.
There seems to be a problem with text search in general. E.g. if I bring up the
Find/Replace dialog (Ctrl-F) and try to search for a simple string (e.g.
"class"), no results are found (incorrectly). Then I turn on the "Regular
expressions" option and it works fine.
This was with eclipse-platform-3.1.0_fc-0.M5.8.
After further investigation, this looks like a problem with GNU Classpath's
regex implementation. Eclipse makes use of the quoting regular expression
constructs (\Q and \E), which aren't implemented in gnu.regexp.RE. A simple test:
Pattern.compile("\\Q" + "boo" + "\\E").matcher("Peekaboo").find()
returns false using gcj and true using java-sun.
I'll file this in classpath's bugzilla; I'm also attaching a patch for
eclipse-3.1M5a which works around the problem.
Created attachment 111736 [details]
Workaround for the lack of quoting regex constructs
I'm trying this patch out now and if things go well, I'll rebuild with it!
*** Bug 150514 has been marked as a duplicate of this bug. ***
Applying the patch lets things like Ctrl-F work but doesn't fix the
larger problem of the main search functionality not working. I've put
the patch into a build that I'm doing now so hopefully that'll make test1.
Thanks again, Ziga.
What are the other symptoms of search functionality not working?
I did find a couple of other cases where the said regex constructs
were used, but they seemed harmless (e.g.
RegExContentAssistProcessor.java). Of course, there are other
shortcomings of there current java.util.regex implementation. I'm
currently writing a Mauve test that should underline those.
The main search function (the flashlight icon) when using the Files
tab (the left-most one) always seems to have the Search button
greyed-out. (I'm not in front of a computer with Eclipse right now so
my from-memory bug comment may seem silly. sorry ;)
The disabled Search button was a native-only issue (could be worked around by
removing the gnu.gcj.precompiled.db.path argument). However, this seems to be
fixed with the latest libgcj update (4.0.0-0.33) -- the Search button is now
enabled in both modes.
But even so, searching files only worked when regular expressions were enabled.
This is again due to the use of quoting regex constructs (this time in
PatternConstructor). I updated my previous patch; hopefully, this will fix all
search related problems.
Note that once the classpath bug is resolved, this patch becomes obsolete.
Created attachment 111954 [details]
Workaround for the lack of quoting regex constructs
I've opened a new libgcj bug which is the same as your classpath bug, Ziga:
I'm also trying a build right now with your updated patch. I'll post back here
when it's done.
Thanks again for all your hard work, Ziga!
Things seem to work for me with gcc* >= 4.0.0-4 (not yet in rawhide IIRC).
General search still seems screwy.
Still no news from the FSF, Ziga?
> Things seem to work for me with gcc* >= 4.0.0-4 (not yet in rawhide IIRC).
> General search still seems screwy.
I couldn't test this with the latest version due to bug #157255 but last I
checked, searching worked fine with the patches (both incremental/editor search
and search in files). Are you seeing the disabled button issue again?
> Still no news from the FSF, Ziga?
Changing state back to NEEDINFO (Bugzilla changed it automatically)
I tried searching with eclipse-jdt-3.1.0_fc-0.M6.16 and libgcj-4.0.0-5.
I can confirm that there are problems with File Search again. However, this
doesn't seem related to the regex issue we had before. I couldn't get file
search to work properly even when using a patched gcc (the patch was committed
today, BTW). Also, selecting "Regular expression" in the dialog box no longer
helps (previously it did).
This looks like an issue with the files included in search. It seems that the
search results only include files that aren't opened.
I'm seeing the same behaviour with File Search that Ziga mentioned. The search
results only includes files which aren't opened.
This works for me now. Should we close? Does it not work for anyone?
(In reply to comment #17)
> This works for me now. Should we close? Does it not work for anyone?
Works for me as well with eclipse-platform-3.1.1-1jpp_1fc.FC4.12. I think this
can be closed.
(In reply to comment #18)
> (In reply to comment #17)
> > This works for me now. Should we close? Does it not work for anyone?
> Works for me as well with eclipse-platform-3.1.1-1jpp_1fc.FC4.12. I think this
> can be closed.
Great, thanks, Ziga!