Bug 106076 - Find and replace formatted text -- some underline not found
Summary: Find and replace formatted text -- some underline not found
Status: RESOLVED DUPLICATE of bug 62603
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.6.7.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Find-Search
  Show dependency treegraph
 
Reported: 2017-02-18 13:30 UTC by Butch
Modified: 2021-01-10 12:28 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
Demo (40.08 KB, application/vnd.oasis.opendocument.text)
2017-02-18 13:30 UTC, Butch
Details
A new, better (?) demo doc (171.55 KB, application/vnd.oasis.opendocument.text)
2017-02-19 12:51 UTC, Butch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Butch 2017-02-18 13:30:22 UTC
Created attachment 131316 [details]
Demo

In some cases Find doesn't find formatted text, or Find/Replace of formatted text removes other formats inside the formatted text.

Not easy to reproduce. See attached document, which describes this behavior and probably reproduces my observations.
Comment 1 Butch 2017-02-18 14:12:36 UTC Comment hidden (obsolete)
Comment 2 Butch 2017-02-19 12:51:37 UTC
Created attachment 131338 [details]
A new, better (?) demo doc
Comment 3 Butch 2017-02-19 12:58:21 UTC
I added now a new demo doc, DemoNEW.fodt, which maybe will show the problem in a reproducible way.

The document contains two macros. Demo1 writes four lines into the document (it is simply a recorded macro), and Demo2 does the replacements (inserting start and end tags for text in 10 pt (<s>) and for underlined text (<u>).)

On my side, as shown on screenshoots included in the document,
-- the format bold is lost with this replacements (lines 2 and 3), and
-- underlined text is not found and replaced (line 4).
Comment 4 Buovjaga 2017-02-19 19:25:10 UTC Comment hidden (obsolete)
Comment 5 Butch 2017-02-20 07:40:29 UTC
I am now able to show the problem in a simple and reproducible way (I hope):

Write these four lines (paragraphs) in a new document:


1 This is a simple one-line paragraph ending with x. x

2 This is a simple one-line paragraph ending with x. x

3 x
4 This is a simple one-line paragraph ending with x. x


Each line ending with x and Enter.
Select now with the mouse the word simple in all lines and make it bold.
Select the whole first line including x and make it underlined.
Select the second line without the ending x and make it underlined.
Select the fourth line without the ending x but including 3 in the third line, and make it underlined.

Do now Search&Replace:
Search: .* with format Underlined single
Replace: <u>$0</u>
with activated Regular expression, Replace all.

The result (at least on my side):
The bold formatting in the first line is lost!

My assumption: There is a inconsistency / intransparency / undesirable behavior in the case when selection includes a paragraph end (the endmark)!

Another observation: When replacing is done for single characters (.), the bold formatting is not lost!
Comment 6 Buovjaga 2017-02-20 10:38:57 UTC Comment hidden (obsolete)
Comment 7 Butch 2017-02-20 10:53:41 UTC Comment hidden (obsolete)
Comment 8 Buovjaga 2017-02-20 11:20:17 UTC Comment hidden (obsolete)
Comment 9 Butch 2017-02-20 11:29:18 UTC Comment hidden (obsolete)
Comment 10 Buovjaga 2017-02-20 11:44:18 UTC Comment hidden (obsolete)
Comment 11 Buovjaga 2017-02-20 16:07:44 UTC
(In reply to Buovjaga from comment #8)
> With 5.4, it says "Search key not found". I think this might have something
> to do with how it is forcing text color into the equation..

Just a note: I could now reproduce the problem in 5.4 by using "Attributes" instead of Format. There I can select Underline and no color will block the search.
Comment 12 QA Administrators 2018-09-12 02:37:40 UTC Comment hidden (obsolete)
Comment 13 QA Administrators 2020-09-12 03:55:53 UTC Comment hidden (obsolete)
Comment 14 Timur 2020-10-22 11:29:30 UTC
Report must be simple. I just searched for Format-Underline and found 5 instead of 6 results. Lo 7.1+.
Comment 15 sdc.blanco 2021-01-10 12:28:51 UTC
@Butch I believe your report is a duplicate of bug 62603.

Tested with 7.2.0.0.alpha0+

The problem is not regex, but that the font attributes of the first matched character is applied to the enter replace string.  (This is also consistent with your observation in comment 5 that formatting is not lost if you replace single characters.)

See bug 62603, comment 24

If you think your case is not a duplicate of bug 62063, then please REOPEN, with an explanation of what is different.

There can also an interaction problem with search with "format" and direct formatting see bug 133439

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