Bug 145627 - Cross reference error if merging two numbered paragraphs
Summary: Cross reference error if merging two numbered paragraphs
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.2.2.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Fields-Cross-Reference
  Show dependency treegraph
 
Reported: 2021-11-11 09:20 UTC by Orwel
Modified: 2023-03-01 12:41 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Test file to reproduce the bug (17.25 KB, application/vnd.oasis.opendocument.text)
2021-11-11 09:21 UTC, Orwel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Orwel 2021-11-11 09:20:30 UTC
Description:
If two numbered paragraphs are merged by deleting the second one (e. g. Level 2 merged to level 1 by deleting numbering of level 2), cross reference which point to the first of them (level 1) brakes.

Steps to Reproduce:
1. Set 2 numbered paragraphs as Line 1 - set numbering level 1 (e. g. 1.) and line 2 - set numbering level 2 (e.g. a.)
2. Create a line 3 with a cross reference to the the line 1
3. Delete numbering in line 2 and merge the text with line 1 (using backspace or delete key)

Actual Results:
In line 3 you get en Cross reference Error

Expected Results:
Cross reference to line 1 should be kept


Reproducible: Always


User Profile Reset: No


OpenGL enabled: Yes

Additional Info:
I am not sure if this is a expected behavior,  but I think it is a bug. As i often work with contracts, sometimes you decide to shorten the text or delete one of two sublevels - in this case you want merge the sublevel text which is remaining to the first level text, e. g.:

A. original tex
1. If the buyer:
   a. pay the price,
   b. take over the item
...
3. In case of point 1. ....

B. New text
1. If the  If the buyer pay the price and take over the item...
...
3. In case of point 1. .... YOU GOT HERE AN ERROR OF CROSS REFERENCE without a reason, as the point 1 is still there.

I attach a test file, where you can try to delete line
Comment 1 Orwel 2021-11-11 09:21:19 UTC
Created attachment 176186 [details]
Test file to reproduce the bug
Comment 2 Dieter 2021-11-26 07:50:24 UTC
It's not easy to reproduce

Steps
1. Open attachment 176186 [details]
2. Put cursor at the and of second line
3. Select text including "Line 1"
4. Delete text and press F9 (Update fields)

Actual result: Error message

Test 2
1. Open attachment 176186 [details]
2. Put cursor at the and of second line
3. Press delete button until everything is deleted including "Line 1"
4. Press F9 (Update fields)

Actual result: Field still works

But it's not clear to me what kind of field it is. If I edit the field and select "Numbered Paragraph" as type, it works as expected. So please give some information about the field.
=> NEEDINFO
Comment 3 Orwel 2021-11-26 17:40:34 UTC
Hallo Dieter,
The reference is: MENU-INSERT-FIELDS-MORE FIELDS-CROSS-references / Type: Numbered paragraph / Insert reference to: Number (no context).

Your reproduction 1/ makes the problem visible.
But let me tell you, the steps you are reproducing are not exactly the same, as I had described (sorry if I was not clear enough). I face this problem when MERGING Line 2 with Line 1 (Line 3 is not edited), this means you should put the cursor somewhere in line 1 and delete the text until end of line 2 (or you can use mouse to select the text also), or much more better (real situation), only use DELETE button on the end of LINE 1 (means press DELETE button only once and exactly on the end of line 1) and than refresh fields.
Comment 4 QA Administrators 2021-11-27 04:31:25 UTC Comment hidden (obsolete)
Comment 5 Dieter 2021-12-05 20:49:31 UTC
(In reply to Orwel from comment #3)
> Hallo Dieter,
> The reference is: MENU-INSERT-FIELDS-MORE FIELDS-CROSS-references / Type:
> Numbered paragraph / Insert reference to: Number (no context).
> 
> Your reproduction 1/ makes the problem visible.
> But let me tell you, the steps you are reproducing are not exactly the same,
> as I had described (sorry if I was not clear enough). I face this problem
> when MERGING Line 2 with Line 1 (Line 3 is not edited), this means you
> should put the cursor somewhere in line 1 and delete the text until end of
> line 2

I can't reproduce the problem with these steps and I also can't reproduce it in current master with my steps from first test in comment 2

Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 2934472ab888ebfe64a153984af2902fac63a7a0
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

Orwel, is it possible for you, to test with actual master: https://dev-builds.libreoffice.org/daily/master/current.html You can install it an parallel.
=> NEEDINFO
Comment 6 Orwel 2021-12-07 11:41:16 UTC
I will test it in 7.4.0.0.alpha0+ (x64) after this built is relase in Separate Install GUI of LO (actually, there is the built 7.3.0.0.beta1 as the last one).
Comment 7 Dieter 2021-12-07 11:46:12 UTC
(In reply to Orwel from comment #6)
> I will test it in 7.4.0.0.alpha0+ (x64) after this built is relase in
> Separate Install GUI of LO (actually, there is the built 7.3.0.0.beta1 as
> the last one).

No, please have a look at https://dev-builds.libreoffice.org/daily/master/current.html. Master is LO 7.4.0.0
Comment 8 Orwel 2021-12-08 08:53:36 UTC
(In reply to Dieter from comment #7)

> 
> No, please have a look at
> https://dev-builds.libreoffice.org/daily/master/current.html. Master is LO
> 7.4.0.0

Sorry, I have no experience with installing portable/test versions without using Separate Install GUI of LO. I do not want risk to affect my existing installation and USER folder. I have no possibility to install it on other PC, so I had to wait until this dev-built will be available in SI GUI of LO, as this is intended for separate and test installations.
Comment 9 Dieter 2021-12-08 09:13:27 UTC
(In reply to Orwel from comment #8)
> Sorry, I have no experience with installing portable/test versions without
> using Separate Install GUI of LO. I do not want risk to affect my existing
> installation and USER folder.

It doesn't affect your existing installation or user folder. And it's the same installation process as with other versions of LO. But of course t's upt to you to decide.
Comment 10 QA Administrators 2022-06-07 03:27:16 UTC Comment hidden (obsolete)
Comment 11 Orwel 2022-06-07 07:49:14 UTC
Hi,
I have tested the bug on:
Version: 7.4.0.0.alpha1 (x64) / LibreOffice Community
Build ID: b871abad383583f02eb49c7e49aeae01f6941072
CPU threads: 16; OS: Windows 10.0 Build 19042; UI render: Skia/Vulkan; VCL: win
Locale: en-GB (sk_SK); UI: en-US
Calc: CL

and it is still present. The behavior is the same. 
USE my test file. 
If you delete the text in 1. Line (using delete button) "PRESS HERE DELETE and update fields" until the Text "Line 2" becomes a part of line 1 and after this you update fields, the cross reference (Number (no context)) breaks and you get Error: Reference source not found.

The file seems (after described changes) like this:
    1. Line 1, Line 2.
    2. Line 3 - Cross reference to line 1 - Error: Reference source not found
Comment 12 QA Administrators 2022-06-08 03:32:16 UTC Comment hidden (obsolete)
Comment 13 Dieter 2022-06-10 09:17:15 UTC
I confirm it with

Version: 7.4.0.0.alpha1+ (x64) / LibreOffice Community
Build ID: 5423dfb8549743bd5045b6e3b1ebad7980e62965
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

Steps:
1. Open attachment 176186 [details]
2. Place cursor at end of first paragraph and presse DELETE once
3. F9 (Update fields)

Actual result
Error message for field