Closed
Bug 126651
Opened 23 years ago
Closed 23 years ago
New find misses after partial matches
Categories
(SeaMonkey :: Composer, defect)
SeaMonkey
Composer
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla0.9.9
People
(Reporter: neil, Assigned: akkzilla)
References
()
Details
(Keywords: regression)
Attachments
(1 file, 6 obsolete files)
20.65 KB,
patch
|
kinmoz
:
superreview+
|
Details | Diff | Splinter Review |
Steps to reproduce problem:
1. Open a new blank page to edit
2. Type "Eerier Aardvarks"
3. Search for "er"
4. Search for "ar"
Expected resutls: both strings found in two locations
Actual results with editor.new_find enabled: both strings only found once.
Mind you if the debug output is anything to go by I'm not surprised.
Assignee | ||
Comment 1•23 years ago
|
||
Yuck! Happens in browser, too. I'm on it.
OS: Windows 95 → All
Hardware: PC → All
Target Milestone: --- → mozilla0.9.9
Assignee | ||
Comment 2•23 years ago
|
||
Aha ... I should have known I was confused about how I was handling partial
matches from that commented-out findex=restart line ... I kept changing my
mind about whether it was needed or not, and the answer is that it's needed
sometimes but not other times.
Seeking review ... and thanks for the cute example, which I will add to the
find test page I"m working on.
Assignee | ||
Comment 3•23 years ago
|
||
In writing a regression test page, I found another problem involving matching
extended spaces. Here's a patch that fixes them both.
Attachment #70567 -
Attachment is obsolete: true
Assignee | ||
Comment 4•23 years ago
|
||
Cc'ing timeless: I was getting "You have reached the end of the internet.
Please go forward now" on a lot of my reverse finds. Commenting out the --iter
fixed the asserts and all my find tests work. It looks like we were right the
first time about removing the --iter line. Opinions? Review?
Status: NEW → ASSIGNED
Assignee | ||
Comment 5•23 years ago
|
||
In case anyone's interested (e.g. when reviewing), here's the test case I'm
currently using. It links to Sujay's editor find/replace test case document,
but includes a lot of tests for specific problems that can crop up in the
algorithm. I will be checking this in to the mozilla.org doc tree next to
Sujay's document.
By all means suggest other tests I haven't covered if you know of any.
Assignee | ||
Comment 6•23 years ago
|
||
Timeless pointed out some confusing indentation, so I've cleaned that up in the
patch. This version also has some cleanup inside DEBUG_FIND statements (so
nobody except me should be affected) and fixes the copyright to say 2002
instead of 2___.
Timeless has agreed with removing the --iter for the nsDeque iterator, but the
last hunk of the patch needs review: setting findex and restart appropriately,
and setting inWhitespace to false when ending a match.
Attachment #70634 -
Attachment is obsolete: true
Assignee | ||
Comment 7•23 years ago
|
||
Comment on attachment 70773 [details] [diff] [review]
Cleaner patch
I spent some more time on my testcase, and came up with a new tougher case that
breaks. Reworking.
Attachment #70773 -
Flags: needs-work+
Assignee | ||
Comment 8•23 years ago
|
||
Attachment #70773 -
Attachment is obsolete: true
Assignee | ||
Comment 9•23 years ago
|
||
The more I looked at how those deque iterators were working, the more I realized
I wasn't using them right, and the more I realized how little we were using the
deque at all. Then I realized: the only reason for using the deque had been for
persistence between calls, which no longer applies, and even then, given that we
already can iterate backward and forward with good performance, it's cleaner
just to do that. In other words, there's no reason to be using a deque at all,
and the deque code just complicates the algorithm and hides subtle bugs.
So I got rid of it. The last patch uses the same algorithm as "Cleaner patch",
except that all references to the deque have been removed, and all iteration is
done via the dom (which fixes the last few subtle bugs I was seeing on my new
test page).
The new test page is here:
http://www.mozilla.org/quality/browser/front-end/testcases/xpapps-gui/find-on-page/find-in-page.html
It includes all of Kin's test plus every hard test I could think of, and
instructions on how to use the page for regression testing. (It then links to
Sujay's editor testing page.)
Kathy and/or Charley, could you please review this? Cc'ing Kin so he knows
what's going on.
Assignee | ||
Comment 10•23 years ago
|
||
Attachment #70846 -
Attachment is obsolete: true
Assignee | ||
Comment 11•23 years ago
|
||
Comment on attachment 70640 [details]
Test cases
Marking the attached test case obsolete, because the one checked into the
mozilla doc tree is much better.
Attachment #70640 -
Attachment is obsolete: true
Comment 12•23 years ago
|
||
+/* boolean Find (in wstring aFindText); */
doesn't really match this:
+NS_IMETHODIMP
+nsFind::Find(const PRUnichar *aPatText, nsIDOMRange* aSearchRange,
+ nsIDOMRange* aStartPoint, nsIDOMRange* aEndPoint,
+ nsIDOMRange** aRangeRet)
+ const PRUnichar* aPatStr = patStr.get();
+ PRInt32 aPatLen = patStr.Length() - 1;
misuse of variable naming convention, a is for argument.
+ // Should check return value -- but what would we do if it failed??
+ // We're in big trouble if that happens.
for now, how about an NS_ASSERTION ?
As for de-dequifying, i agree it's the right thing to do.
+ mIterNode->QueryInterface(nsITextContent::GetIID(), (void**)&tc);
is this the prefered way to clal QI (i.e. using ::GetIID)?
Assignee | ||
Comment 13•23 years ago
|
||
It's true about the variable naming conventions. To be frank, I was trying to
keep the diffs as small as possible to help reviewers. But that won't seem very
valid a year from now ... you're right, I should just bite the bullet and rename
them now. Here's a new patch.
Also clarifying the summary (it's not just editor find and it happens with
default prefs) and adding keywords to nominate it in case that's needed.
Keywords: nsbeta1,
regression
Summary: find problem with editor.new_find enabled → New find misses after partial matches
Assignee | ||
Comment 14•23 years ago
|
||
Rename the variables as timeless suggested, and remove that misleading and
unneeded usage comment. It also makes tc an nsCOMPtr (it wasn't before because
we needed to keep track of addrefs explicitly since the deque didn't) so we can
use do_QueryInterface in the normal way.
Attachment #70848 -
Attachment is obsolete: true
Assignee | ||
Updated•23 years ago
|
Comment 15•23 years ago
|
||
Comment on attachment 70936 [details] [diff] [review]
Full dedequification 2
r=cmanske
Attachment #70936 -
Flags: review+
Comment 16•23 years ago
|
||
Comment on attachment 70936 [details] [diff] [review]
Full dedequification 2
sr=kin@netscape.com with the changes we discussed on IRC:
1. Lose the queue references in the comments.
2. Fix the double assertion.
Attachment #70936 -
Flags: review+ → superreview+
Assignee | ||
Comment 18•23 years ago
|
||
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Updated•20 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•