Issue 102333 - Search and replace Empty paragraphs ends in a loop
Summary: Search and replace Empty paragraphs ends in a loop
Alias: None
Product: Writer
Classification: Application
Component: editing (show other issues)
Version: OOo 3.1
Hardware: All Windows, all
: P2 Trivial (vote)
Target Milestone: 3.4.0
QA Contact: issues@sw
Keywords: regression
: 110026 114342 (view as issue list)
Depends on:
Blocks: 97765
  Show dependency tree
Reported: 2009-05-28 14:30 UTC by cno
Modified: 2017-05-20 10:30 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

writer doc for my test (7.63 KB, application/vnd.oasis.opendocument.text)
2009-05-28 15:06 UTC, cno
no flags Details
screenprint of message and search and replace dialog (77.19 KB, image/png)
2009-05-28 15:08 UTC, cno
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description cno 2009-05-28 14:30:54 UTC
- New writer document
- number of paragraphs, some with a word, some without
- start Search and Replace
- Find ^$ replace with \n, regular expression on
- Replace All
  >  freeze or loop 
    with in between message:
    "You first have to disable the function Undo, to be able to
    do this action. Di you wnat to disable the function Undo?
    Yes | No | Cancel"
  Either of those options does not work
Comment 1 cno 2009-05-28 15:06:07 UTC
Created attachment 62621 [details]
writer doc for my test
Comment 2 cno 2009-05-28 15:08:14 UTC
Created attachment 62622 [details]
screenprint of message and search and replace dialog
Comment 3 eric.savary 2009-05-29 11:00:43 UTC
Confirmed on Vista.

@OS: didn't loop in 2.4.
The step by step manual Find/Replace works find but the Replace All seems to do
- Found empty paragraph (^$)
- *Doesn't replace but adds* an empty paragraph (\n)
- Found empty paragraph (just added \n)
an so on...

At least this is what I can imagine when I stop the routing answering Cancel to
the "Turn undo off" warning.
The document then shows the word "first" at 1st paragraph followed with tons of
empty paragraphs (I got 1112 pages after canceling!)

@cornouws: for what I guess you want to achieve, don't write "\n" in Replace but
leave the field empty :)

Comment 4 cno 2009-05-30 19:05:55 UTC
hi es,

Thanks for your suggestion. Indeed it works.
Comment 5 Oliver Specht 2009-06-17 14:23:26 UTC
Target changed to OOO Later.
Comment 6 cno 2009-06-17 14:49:12 UTC
@ es:
Looking at this again, the current behaviour is logic.
But the old one is a trick I learned some/long time ago from whatever documentation.
Maybe the behaviour was changed by intention?

I cheched the OLH and the linked wiki-pages, and that is not the source of my
info. So no need to wory from that POV as well...
Comment 7 ftack 2009-07-17 10:25:50 UTC
Why is the \n still adding a paragraph mark, while in the "search for" box, the
symbol stands for a line break?
Comment 8 michael.ruess 2010-03-10 16:21:09 UTC
*** Issue 110026 has been marked as a duplicate of this issue. ***
Comment 9 michael.ruess 2010-09-06 11:25:20 UTC
*** Issue 114342 has been marked as a duplicate of this issue. ***
Comment 10 michael.ruess 2010-09-06 11:27:03 UTC
IMO a P2-loop is not worth targeting to "later"...
Comment 11 caolanm 2010-09-06 11:32:52 UTC
FWIW, one of the MS guys at OOoCon2010 was rather poking fun at writer for this,
i.e. its an example trotted out to demonstrate OOo failings
Comment 12 stefan.baltzer 2010-11-15 15:37:32 UTC
See also issue 115528 "Freeze on simple Find/Replace involving formatting".
Looks somewhat similar.
Comment 13 Oliver Brinzing 2010-11-21 13:53:49 UTC
Comment 14 Andrea Pescetti 2011-02-19 20:35:44 UTC
Setting target 3.4 as per
Comment 15 2011-03-01 13:27:42 UTC

setting "regression" flag due to comment #3 by es
Comment 16 2011-03-01 14:52:27 UTC
caused by a spurious cursor move in SwDoc::ReplaceRangeImpl.

the following bug has the same root cause:
1. enter (new paragraph)
2. type "bar"
3. search&replace "^$" => "\nfoo" + regex, ReplaceAll
4. second para is now "foobar"
5. undo
6. second para is now "obar", not "bar"!
7. every redo+undo adds another "o"...
Comment 17 2011-03-01 15:39:11 UTC
fixed in CWS sw34bf04
Comment 18 stefan.baltzer 2011-03-16 13:32:05 UTC
Verified in CWS sw34bf04.
Comment 19 stefan.baltzer 2011-03-16 15:51:00 UTC
Verified in CWS sw34bf04.