Bug 135938 - Highlighted cross-reference is not displayed in dialog "Name" entry
Summary: Highlighted cross-reference is not displayed in dialog "Name" entry
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.0.0.3 release
Hardware: All All
: medium minor
Assignee: Andreas Heinisch
URL:
Whiteboard: target:7.5.0 target:7.4.3 target:7.6....
Keywords:
Depends on:
Blocks: Cross-reference-dialog
  Show dependency treegraph
 
Reported: 2020-08-20 08:27 UTC by Alberto Rossi
Modified: 2023-01-27 14:07 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Bug 135938 attachment 1 (example) (8.70 KB, application/vnd.oasis.opendocument.text)
2020-09-16 06:05 UTC, Alberto Rossi
Details
LO version 7.0.2.2. (82.22 KB, image/png)
2020-10-10 16:05 UTC, Alberto Rossi
Details
Crossed reference bug video (14.48 MB, video/avi)
2020-10-10 16:28 UTC, Alberto Rossi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alberto Rossi 2020-08-20 08:27:12 UTC
If you want to insert a cross-reference to a specific target and you search for the name of the target in the upper field, all targets containing that specific string will appear. However, if you double click on the desired target, thinking that this action will insert the target's page number in the document, the page number of the first target of the list will be inserted instead. This is due to the fact, I resume, that the name of the first target will remain in the lower field (Name).
Problem is that, before you find out about this you may already have added many references and must go back to each one.
Do not use the search filed but scroll through the targets and double click on the desired one, instead or, before double clicking on it, click to select it and then double click.
Extra note: if you double click on a target picked from the list without using the search field, the correct number will be added.
Comment 1 Dieter 2020-08-20 15:27:04 UTC
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug. 
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
(Please note that the attachment will be public, remove any sensitive information before attaching it)
Comment 2 Alberto Rossi 2020-09-16 06:05:32 UTC
Created attachment 165555 [details]
Bug 135938 attachment 1 (example)
Comment 3 Alberto Rossi 2020-09-16 06:06:11 UTC
Hello, attached is the requested document.
There are two references, 1 in page 1 called AAATitle 1 and 1 in page 2 called ZZZTitle 2.
In this way they the first one will be on top in the references list, the second one will be at the end of the list.

There is already a reference the AAATitle 1 inserted in the sentence on top ("See Title 1 page 1.")

Now place a reference at the end of the second sentence "See Title 2 page ." (of course this works wherever you place the reference).

Note: I'm using LibreOffice in Italian so I'm just translating the menu items not sure if they are exactly the same in the English version.

1- Click Insert - crossed reference...
2- Select Insert Reference on the top left box (Type). In the right list AAATitle 1 should be highlighted.
3- Type ZZZ in the field above the list, below Selection (search field). Only ZZZTitle 2 will be listed and highlighted. One would think that is selected also. In fact, in the Name field AAATitle 1 is present.
4- Click Insert in the bottom right corner and then Close.
5- Check the inserted reference: it will be page 1 because as a matter of fact ZZZTitle 2, even though it was highlighted, it was not selected actually.

If you repeat the operations 1, 2 and 3 and you have only ZZZTitle 2 in the list and highlighted, even if you click on it it won't be selected. To be able to select it you need other items in the list to click and then click again on the desired one or do not use the search function and scroll the list to spot the desired reference.

I hope it is clear.
Comment 4 Dieter 2020-10-10 04:51:37 UTC
Thank you for the document. That makes it clear. I could folow the provided steps, but I couldn't reproduce it with

Version: 7.0.2.2 (x64)
Build ID: 8349ace3c3162073abd90d81fd06dcfb6b36b994
CPU threads: 4; OS: Windows 10.0 Build 19041; UI render: Skia/Raster; VCL: win
Locale: he-IL (de_DE); UI: en-GB
Calc: threaded

Perhaps the problem has been solved recently. So perhaps you can give it a try with the latest version of LibreOffice from https://www.libreoffice.org/download/libreoffice-fresh/ Please also copy and paste informations from Help => About LibreOffice
Comment 5 Alberto Rossi 2020-10-10 16:05:17 UTC
I've downloaded latest version available in Italian, see attached picture. Problem still occurs exactly in the same way I described.
Whenever you use the search field to insert a crossed reference, even though the searched reference is highlighted in the list, in the Name field below it will always appear the first item of the list, even though is not visible in the list (because of the search string you entered).
If you click OK it will add a reference to the reference in the Name field and not the highlighted one. You have to click on the wanted reference, even if it is highlighted, to actually select it. It is tricky because you think it is selected but it is not!
Comment 6 Alberto Rossi 2020-10-10 16:05:43 UTC
Created attachment 166256 [details]
LO version 7.0.2.2.
Comment 7 Alberto Rossi 2020-10-10 16:28:04 UTC
Created attachment 166257 [details]
Crossed reference bug video
Comment 8 Alberto Rossi 2020-10-10 16:28:46 UTC
I've attached a video of the bug, this should clarify it completely.
Comment 9 Dieter 2020-10-16 09:41:49 UTC
Alberto, thanks for the video, now I can reproduce your steps with

Version: 7.0.2.2 (x64)
Build ID: 8349ace3c3162073abd90d81fd06dcfb6b36b994
CPU threads: 4; OS: Windows 10.0 Build 19041; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: threaded

Additional observtion
If I press insert (step 4)"Name" entry changes to "ZZZ Title 2" and I can insert that cross reference.

I would expect one of the following behaviours:
a) "name" entry should always display highlighted reference
or
b) Dialog shouldn't highlight a reference until it is selected by the user
or
c) "Name" entry should be empty until a reference is selected by the user

cc: Design-Team for decision
Comment 10 Heiko Tietze 2020-10-21 14:24:22 UTC
Let's recap to make sure I understand:
You use Insert > Cross-reference > Set Reference on page 1 to set a reference "One" and another "Two" on page 2 and expect Insert Reference / to page to show the page number where you have set it. Correct?

The help is here https://help.libreoffice.org/7.1/en-US/text/swriter/01/04090002.html
Comment 11 Alberto Rossi 2020-10-21 14:37:42 UTC
Dear Heiko,
it is clear how the references work, thank you. However there is a bug when trying to insert a reference (not set a reference) using the search button and the video shows it I believe beyond any doubt. When you use the Search field and type the name of the reference you want to insert, the list will show values according to your Search string and will highlight the first one but the name of the reference in the Name field below the list will remain the first one of the original list (before the Search function is applied) and if you click on ok it will be inserted a reference to the latter and not to the highlighted one.
Comment 12 Heiko Tietze 2020-10-22 08:48:58 UTC
Got it, clearly a bug.

Insert > Cross-reference > Set Reference: enter some references, go to Insert Reference, use filter selection to show only one item in the list. Issue is that despite this item is highlighted the last selected is still active in the name field and will be taken into the document. 

The name field has to follow list updates when using the filter.
Comment 13 Commit Notification 2022-10-06 19:51:17 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/fe51aa0a8d796b456a3c6966c47afc98e4532cd0

tdf#135938 - Refresh cross-reference name after filter selection has changed

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2022-10-07 10:05:34 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/c5d32e7a9a58e1643f1ef10bb24de40c58ab0edc

tdf#135938 - Refresh cross-reference name after filter selection has changed

It will be available in 7.4.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Dieter 2022-10-15 15:59:20 UTC
VERIFIED with

Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 8991cbb7986d3967bc6c3719d95254ff04428d1a
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 threaded

Andreas, thanks for fixing it!
Comment 16 Commit Notification 2022-10-17 16:00:38 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/923b75d9cae657a6bf18851c6105513ddab5e95d

tdf#135938 - Partially revert fix test case

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 17 Commit Notification 2023-01-19 22:58:04 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a29ec09f7c2a01f131095fd9b2ecafa0812e8325

tdf#135938 - Search for "insert reference" tree entry

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Commit Notification 2023-01-26 16:17:24 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/313b04a8ab3cf67223c18f70b348017173a95f6b

tdf#135938 - Search for "insert reference" tree entry

It will be available in 7.5.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 19 Commit Notification 2023-01-26 16:28:31 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/3bbb77bef7e5d05b8584330514be9e384178936e

tdf#135938 - Search for "insert reference" tree entry

It will be available in 7.4.5.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 20 Xisco Faulí 2023-01-27 14:07:48 UTC
7.4.5 was a hotfix release, updating target in status-whiteboard