Search/Replace Strange Behavior

Jeanne A. E. DeVoto revolution at jaedworks.com
Fri Jul 15 01:47:26 EDT 2005


At 11:58 AM -0700 7/14/2005, Mark Swindell wrote:
>I just had a strange behavior I wonder if anyone can explain.  I 
>have a card with 3 fields containing many pages of narrative text. 
>They are extensively formatted with linked text, colors, etc.  I 
>used the search and replace to change occurrences of two spaces (I 
>learned to type long ago on manual typewriters and can't shake the 
>habit) to only one space.   I just typed in two spaces in the find 
>field, and one in the replace field.  I limited the find/replace 
>function to field text.  I pressed replace, and all formatting was 
>lost on all three fields.  Is this a bug, or a feature?  I certainly 
>didn't expect it.

It's a "nuance" or a "design flaw", depending on how charitable 
you're feeling. The replace command treats its parameters as pure 
text, so if you do something like

   replace "foo" with "bar" in field "Stuff"

you'll lose all formatting in the field. Replace seems to make a copy 
of the target text, then do the replace operation, and then swap the 
target text back into the field.

The find/replace dialog really ought to be using htmlText, I think, 
although then a certain amount of conniptions would be required to 
avoid replacing text in an HTML tag.
-- 
jeanne a. e. devoto ~ revolution at jaedworks.com
http://www.jaedworks.com



More information about the use-livecode mailing list