Bug 149793 - Undo search & replaced regex $ fails and causes major subsequent undo/redo problems
Summary: Undo search & replaced regex $ fails and causes major subsequent undo/redo pr...
Status: RESOLVED DUPLICATE of bug 140007
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
Depends on:
Reported: 2022-06-30 16:00 UTC by William Friedman
Modified: 2022-06-30 17:36 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description William Friedman 2022-06-30 16:00:57 UTC
If one searches for the regex $ and replaces it, undo only undoes the replacement but does not replace the end-of-paragraph marker, resulting in further broken undo/redo behavior that ultimately causes !!br0ken!! to appear multiples times.

Steps to Reproduce:
1. Open a new document. Turn on View | Formatting Marks just to make sure you can see what's happening clearly. (This doesn't affect the bug, it happens with this option on or off.)
2. Type the letter A followed by a hard return, the letter B followed by a hard return, and C. If you turned on formatting marks, you should see A, B, and C followed by an end-of-paragraph (EOP) mark.
3. Open Find and Replace. Put $ in the search box. Put a space (or anything) in the replace box. Make sure "Regular Expressions" is checked under "other options." Hit Replace All. ABC should now appear on one line, followed by a single EOP mark.
4. Now hit undo. Whatever you replaced $ with is gone, but ABC is still on one line, followed by an EOP mark, and two EOP marks have returned below that line. The cursor is after the A.
5. Now hit undo again. Cursor goes to the beginning of the third line, as if the letter C had been erased.
6. Now hit undo again. Cursor jumps up as if B had just been erased. The EOP mark on the third line is gone. EOP mark on the second line is still there.
7. Now hit undo again. Nothing happens.
8. Now hit undo again. EOP mark on the second line disappears, cursor jumps after the A.
9. Now hit undo again. A disappears. BC and EOP mark still on first line.
10. Undo is unavailable. Now hit redo. A returns.
11. Hit redo. EOP mark appears after A, BC followed by EOP mark goes to next line.
12. Hit redo. !!br0ken!! appears before BC followed by EOP mark.
13. Hit redo. An EOP mark is inserted, moving "!br0ken!!BC" to the next line.
14. Hit redo. !!br0ken!! appears. 
15. Hit redo again. The EOP markers are removed and replaced by whatever you replaced the EOP markers with in your first search-and-replace.
16. This sequence can be repeated ad infinitum.

Actual Results:
As described above.

Expected Results:
The actual results of the replace of the EOP makers should be undone.

Reproducible: Always

User Profile Reset: No

Additional Info:
Version: (x64) / LibreOffice Community
Build ID: 728fec16bd5f605073805c3c9e7c4212a0120dc5
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL
Comment 1 Mike Kaganski 2022-06-30 17:36:02 UTC

*** This bug has been marked as a duplicate of bug 140007 ***