Bug 153130 - Copying text and placing it in search - search fails to find that text
Summary: Copying text and placing it in search - search fails to find that text
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
6.0 all versions
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-20 22:23 UTC by dcm-bugzilla
Modified: 2023-01-21 15:32 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Step 1: Go to YouTube transcripts (271.07 KB, image/png)
2023-01-21 04:46 UTC, dcm-bugzilla
Details
Step 2: Select some or all of the transcript. (81.53 KB, image/png)
2023-01-21 04:47 UTC, dcm-bugzilla
Details
Step 3: Right click and copy it. (71.38 KB, image/png)
2023-01-21 04:49 UTC, dcm-bugzilla
Details
Step 4: Open LibreOffice Writer and a new document and paste as unformatted text. (65.51 KB, image/png)
2023-01-21 04:50 UTC, dcm-bugzilla
Details
Step 5: It should look like this. If not, enable view of paragraph marks. (95.97 KB, image/png)
2023-01-21 04:50 UTC, dcm-bugzilla
Details
Step 6: Select a few lines including a time stamp. (101.24 KB, image/png)
2023-01-21 04:52 UTC, dcm-bugzilla
Details
Step 7. Copy the selected text. (112.47 KB, image/png)
2023-01-21 04:53 UTC, dcm-bugzilla
Details
Step 8: Open Find & Replace, and paste the text segment in the find box (145.67 KB, image/png)
2023-01-21 04:54 UTC, dcm-bugzilla
Details
Step 9: Press Find Next. (148.19 KB, image/png)
2023-01-21 05:02 UTC, dcm-bugzilla
Details
Step 8: Open Find & Replace, and paste the text segment in the find box. (145.67 KB, image/png)
2023-01-21 05:10 UTC, dcm-bugzilla
Details
Step 9: Press Find Next. (181.37 KB, image/png)
2023-01-21 05:13 UTC, dcm-bugzilla
Details
Step 10: Under "Other Options" select "Regular expressions" and then click Find Next. (180.78 KB, image/png)
2023-01-21 05:15 UTC, dcm-bugzilla
Details
Step 11: Put $ where the paragraph marks are in the original document and press Find Next. (181.35 KB, image/png)
2023-01-21 05:17 UTC, dcm-bugzilla
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dcm-bugzilla 2023-01-20 22:23:06 UTC
Description:
Copying text from a file and placing it in search should ALWAYS then result in a successful search, that finds the copied text. It does not in LibreOffice Writer if the copied text includes a paragraph return mark, even if View is set to show these marks. It is an insanely annoying bug because it is especially things like line endings that are difficult to code for a search due to inconsistent use across apps of how to show a paragraph mark - depending on the app it might be $, \r, ^p or something else. 

Steps to Reproduce:
The use case here is, for a YouTube transcript, replace the paragraph mark before the timecode with a space. In doing that, I encountered a general problem with Find.

1.Write something with a few paragraph marks like this (copied from a YouTube Transcript):
whenever I use these systems, I always  feel myself yearning for more artistic  
0:55
control. I want to specify the pose  for these characters. 
 
2. For clarity on the problem setup, in the above, there should be a paragraph return before and after the 0:55. In LibreOffice Writer, enable View of Formatting Marks. The text should show paragraph marks shown at the end of each line (i.e. after 'artistic' and after '0:55'.) No other formatting marks appear in the document. 

3. Select and then copy the following text in 1: artistic  
0:55
control
 
4. Open Edit - Find and Replace. Click Regular Expressions. Paste the copied text in the Find box. Note it does not show the paragraph marks.
  
5. Press Find Next. Note that it will not find the phrase (search key not found). 
 
6. Put $ in for the paragraph marks in the pasted text in the Find box (i.e. after artistic and after 0:05, so we now have in the Find box: artistic$0:55$control 
Press Find Next. Note that it will not find the phrase (search key not found). 

7. Put $[0-9] in the Find field. Press Find Next. Note that it will not find the phrase (search key not found).



Actual Results:
See 4., 5., 6., and 7. above.

Expected Results:
4. I expected it to show the paragraph marks using the special search code for paragraph marks, so I could hit Find Next and it would find the copied text in the document, without me having to make any changes to the text pasted in the Find box
 
5. I expected it to find the phrase in the document.
 
6. I expected there to be no need to manually add special codes to be able to find the copied text. I also expected - in its current form where I need to add special codes - that once I add the special code for paragraph mark ($), it will find the copied text in the document. 
 
7. I expected it to find target (0:55) in the document.



Reproducible: Always


User Profile Reset: No

Additional Info:
See "expected Results". LibreOffice help was not helpful.
Comment 1 m_a_riosv 2023-01-21 00:48:27 UTC
Please attach a sample file, with indication from where to copy the text to search.
Comment 2 dcm-bugzilla 2023-01-21 04:46:55 UTC
Created attachment 184800 [details]
Step 1: Go to YouTube transcripts

This is a different YouTube transcript than in the bug report but shows the same issue. Step 1: Go to YouTube transcripts by clicking the three dots to the right of Download.
Comment 3 dcm-bugzilla 2023-01-21 04:47:46 UTC
Created attachment 184801 [details]
Step 2: Select some or all of the transcript.

Step 2: Select some or all of the transcript.
Comment 4 dcm-bugzilla 2023-01-21 04:49:05 UTC
Created attachment 184802 [details]
Step 3: Right click and copy it.

Step 3: Right click and copy it. (This is with Chrome on Linux BTW.)
Comment 5 dcm-bugzilla 2023-01-21 04:50:20 UTC
Created attachment 184803 [details]
Step 4: Open LibreOffice Writer and a new document and paste as unformatted text.

Step 4: Open LibreOffice Writer and a new document and paste what we copied as unformatted text.
Comment 6 dcm-bugzilla 2023-01-21 04:50:59 UTC
Created attachment 184804 [details]
Step 5: It should look like this. If not, enable view of paragraph marks.

Step 5: It should look like this. If not, enable view of paragraph marks.
Comment 7 dcm-bugzilla 2023-01-21 04:52:47 UTC
Created attachment 184805 [details]
Step 6: Select a few lines including a time stamp.

Step 6: Select "even against the whole world, 0:06you were not".
Comment 8 dcm-bugzilla 2023-01-21 04:53:49 UTC
Created attachment 184806 [details]
Step 7. Copy the selected text.

Step 7. Copy the selected text.
Comment 9 dcm-bugzilla 2023-01-21 04:54:56 UTC
Created attachment 184807 [details]
Step 8: Open Find & Replace, and paste the text segment in the find box

Step 8: Open Find & Replace, and paste the text segment in the find box
Comment 10 dcm-bugzilla 2023-01-21 05:02:40 UTC
Created attachment 184808 [details]
Step 9: Press Find Next.

Step 9: Press Find Next. It returns "Search key not found" despite the search key being a direct copy-paste from the text.
Comment 11 dcm-bugzilla 2023-01-21 05:10:24 UTC
Created attachment 184809 [details]
Step 8: Open Find & Replace, and paste the text segment in the find box.

Step 8: Open Find & Replace, and paste the text segment in the find box.
Comment 12 dcm-bugzilla 2023-01-21 05:13:03 UTC
Created attachment 184810 [details]
Step 9: Press Find Next.

Step 9: Press Find Next. It returns "Search Key Not Found" even though it was a direct copy of the text from the document.
Comment 13 dcm-bugzilla 2023-01-21 05:15:50 UTC
Created attachment 184811 [details]
Step 10: Under "Other Options" select "Regular expressions" and then click Find Next.

Step 10: Under "Other Options" select "Regular expressions" and then click Find Next. It still returns "Search key not found". (I know, this is not a regular expression - not yet. Stay tuned.)
Comment 14 dcm-bugzilla 2023-01-21 05:17:17 UTC
Created attachment 184812 [details]
Step 11: Put $ where the paragraph marks are in the original document and press Find Next.

Step 11: Put $ where the paragraph marks are in the original document. Make sure "Regular expressions" are enabled under "Other options". Now press Find Next. It still returns "Search key not found."
Comment 15 Mike Kaganski 2023-01-21 05:46:55 UTC
Basically, this is a fundamental limitation of the built-in Find & Replace tool, that it only searches *in the bounds of a single paragraph* at any moment. One can't search for anything spanning across several paragraphs.
Comment 16 dcm-bugzilla 2023-01-21 06:29:51 UTC
Thanks for the impressively fast feedback on the bug report and on the images. Thanks also for letting me know that it is a current limitation and I wasn't just unaware of the right way to do it. 
 
It is an important capability in editing. When I paste in text from a source that is not a word processing document, this type of cleanup of line breaks is commonly needed. For example, I ran into it because I wanted to remove the paragraph marks in front of the YouTube transcript timestamps so they would appear at the end of the lines, making the transcript text much more readable. 
 
The inability to do this type of find (or find & replace) is a major limitation. Word and Notepad++ both allow find & replace of paragraph marks. Hopefully the capability can be added in a future release. It is weird to have to use a different editor to pre-process text destined for LibreOffice Writer, especially if it is a paid program like Word. 
 
(FWIW, Notepad++ - the Windows version - has  an especially clean implementation - better than Notepadqq, the Linux version - because it explicitly shows precisely what special characters make up the paragraph mark. That makes it very easy to match the desired string in the Find target. The Notepadqq Linux version for some weird reason does not use this explicit display of the line termination characters. Explicit display is also super important because of the variations for Linux and Windows - CRLF, LF and sometimes just CR.)
Comment 17 m_a_riosv 2023-01-21 15:32:04 UTC
But If I'm not wrong, you can do it with the extension:
https://extensions.libreoffice.org/en/extensions/show/alternative-dialog-find-replace-for-writer