Pages ’09: Bug with ‘Replace’ command

Posted by Pierre Igot in: Pages
June 1st, 2009 • 3:24 pm

There is a pretty significant bug with the Find/Replace feature in Pages ’09, which makes it rather difficult to trust the application to do the right thing when editing documents with styled text.

Here is the scenario.

Say you have a Pages document containing a paragraph of text in body style, followed by a paragraph of text in heading style, followed by another paragraph of text in body style. And say that, for some reason, you have a trailing space after the period and before the return char at the end of the paragraphs in body text. Here’s what it would look like:

Paragraphs with trailing spaces

If you only have one or two such trailing spaces, you can delete them manually. But what if you have hundreds of them in your document and want to delete them all? Well, the logical thing to do is to use the “Find/Replace” dialog for this purpose. You can put a space followed by a return character (option-Return) in the “Find:” field, and a return character in the “Replace:” field, and specify that the change should apply to the entire document and affect all paragraphs, regardless of their style. This is what I have done in the dialog below, although it’s hard to see the space before the paragraph mark in the “Find:” field, because it’s just a bit of white space next to the padding on the left edge of the field:

Find/Replace dialog

And then you can just hit the “Replace All” button and be done with it, right?

There only one slight problem with this. Here’s what you actually get if you use the “Find/Replace” dialog to fix the trailing spaces before the paragraph marks:

Paragraphs without trailing spaces

What happened to the style of the second paragraph? Well, it’s simply gone. Why? Because, apparently, in the process of replacing the paragraph mark at the end of the first paragraph preceded by a trailing space with a paragraph mark without the trailing space, Pages’s “Find/Replace” dialog changes the paragraph style of the following paragraph as well!

This is pretty bad. The understanding in all modern processors is that the paragraph style of any given paragraph is “stored” in the paragraph mark at the end of that paragraph. So the paragraph mark at the end of the first paragraph in the example above contains the style of the first paragraph, i.e. the body style. And the paragraph style of the second paragraph (the heading) is stored in the paragraph mark at the end of that second paragraph, and has absolutely nothing to do with the paragraph mark of the first paragraph.

Yet obviously in the process of replacing the paragraph mark at the end of the first paragraph, Pages somehow replaces the style of the following paragraph as well. Ouch.

The bottom line here is that you cannot trust Pages ’09 to do proper batch find/replace operations involving paragraph marks. If you need to clean up trailing spaces, you better do it in some other programs, or, if you have the patience, do it manually in Pages. Not a pretty scene.


Comments are closed.