Re: bug in TextFinder.m (also in TextEdit)
Re: bug in TextFinder.m (also in TextEdit)
- Subject: Re: bug in TextFinder.m (also in TextEdit)
- From: "David P. Henderson" <email@hidden>
- Date: Wed, 22 Aug 2001 18:52:48 -0400
On Wednesday, August 22, 2001, at 03:31 , John C. Randolph wrote:
On Wednesday, August 22, 2001, at 11:48 AM, Oliver Chern wrote:
I'm not quite sure if this is the right listserver to send to, but
since
I've seen Ali Ozer post a couple times here and I'm sure a couple ppl
have
used Textfinder.h and textfinder.m in their source code, I figured I
should
point out this bug here.
when a user clicks replace, and then replace & next, he gets an
unwanted
duplicate of the replace string.
Example:
asdf
asdf
Find: asdf
Replace With: zako
1. click "next" to find the search string "asdf".
2. click "replace" to replace "asdf" with "zako".
3. click "replace and find" with the same search strings.
u'll end up with:
zakozako
asdf
just thought u'd like to know.
The bug there isn't in the behaviour of the code, it's in the confusing
title of the button. "Replace" inserts the replacement string in place
of the current selection. After step 2, the selection is right after
the string you inserted, and it has zero length. To get the behaviour
you want, don't use the "replace" button, just use the "replace and
find."
Not only that if it is a bug, it exists in just about every mac
application with this functionality past and present. Like JCR said,
replace refers only to the current selection which may or may not be the
found text. Try it. Do a find then change the selection and do a
replace. Now try it in any application like BBEdit.
Dave
--
Chaos Assembly Werks
"Beautiful bodies and beautiful personalities rarely go together."
- Carl Jung