Bug 138781 - FIND & REPLACE DIALOG: Write cannot find empty paragraphs in a table (== empty cells).
Summary: FIND & REPLACE DIALOG: Write cannot find empty paragraphs in a table (== empt...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Find-Search
  Show dependency treegraph
 
Reported: 2020-12-09 16:45 UTC by Matthijs Melchior
Modified: 2023-04-22 04:00 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthijs Melchior 2020-12-09 16:45:31 UTC
Use the following scenario to see the problems:

The steps marked with * designate incorrect behavior, I expect the correct behavior is obvious.

    1. Create new text document
    2. Click "Toggle Formatting Marks" see the empty paragraphs.
    3. Type "Enter" 10 times to create 10 empty paragraphs.
    4. insert a big table (6x6) after paragraph 5.
    5. Make some paragraphs non-empty, like "X" in line 3, in some table cells and on line 8.
    6. Move cursor to begin of document.
    7. Click "Find and Replace"
    8. For reference, enter "X" as find string and click "Find All"
    9. Note this correctly finds all "X" paragraphs, both inside and outside the table.
    10. Click "Regular expressions"
    11. Find empty paragraphs: search for "^$" and click "Find All"
    12. Most of the empty paragraphs outside the table are marked.
 *  13. The last empty paragraphs before the table and before the end of document are not marked *
 *  14. No cells in the table are marked *
 *  15. Note "Find Next" works correctly, and "Find Previous" moves to the begin of document *
    16. Select the whole table
    17. Check the checkbox "Current selection only"
    18. Note "^$" is still there and click "Find All"
 *  19. The non-empty paragraphs and the last empty one in the table are selected *
 *  20. Click "Find Next" and the first empty paragraph in the document is selected *
    21. Close Find dialogue
    22. Select the whole table
    23. Click "Find and Replace"
    24. Click “Find All”
 *  25. Note: non-empty cells and the last cell is selected *
    26. Click “Find All”
 *  27. Now the last two paragraphs of the table are selected *


My intention is to select all empty cells in the table and assign a different font and background color for the digits that are to be entered later into those cells.

See also bugs 34596, 129449 pertaining to last empty paragraphs.
Comment 1 Dieter 2020-12-27 12:46:18 UTC
(In reply to Matthijs Melchior from comment #0)

I confirm it with

Version: 7.2.0.0.alpha0+ (x64)
Build ID: 315c7570c4a72f4c834086082825533b1e50d1bf
CPU threads: 4; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: threaded

and the following results (somethmes a little different):

> 11. Find empty paragraphs: search for "^$" and click "Find All"
> 12. Most of the empty paragraphs outside the table are marked.
> 13. The last empty paragraphs before the table and before the end of
> document are not marked *
> 14. No cells in the table are marked
I confirm that.

> 15. Note "Find Next" works correctly
I can't confirm. Same wrong result as "Find All"

> and "Find Previous" moves to the begin of document
I confirm that.


> 19. The non-empty paragraphs and the last empty one in the table are
> selected
Different result: All cells with a "x" and last empty cell are selected.

> 20. Click "Find Next" and the first empty paragraph in the document is
> selected
I confirm it.

> 21. Close Find dialogue
> 22. Select the whole table
> 23. Click "Find and Replace"
> 24. Click “Find All”
> 25. Note: non-empty cells and the last cell is selected
I confirm it (same result as after step 20)

> 26. Click “Find All”
> 27. Now the last two paragraphs of the table are selected
I confirm it
Comment 2 V Stuart Foote 2020-12-27 17:08:03 UTC
Nothing new here. The "^$" or "$^" 'regex' matches are not defined in the ICU libs and are coded as needed. For Writer that is in findtxt.cxx with the 'bChkEmptyPara' tests. 

Seems like the 'EMPTY' values of sw Table cells are not treated in similar fashion during "^$" or "$^" regex finds of empty paragraphs. 

If possible, seems an overdue enhancement to make our regex finds of empty elements consistent.