[Bug 131302] Blank character inserted before caption category text in Sub-Documents shows up in Master Document indices

Reported as bug: LibreOffice Bug 131302

Adding a caption to an inserted image injects an unnecessary space in the index when it is generated. This is another difference between OpenOffice 4.6 and LO6.3 that can be overridden but is very annoying. If I insert an image and create a caption, for example a Map, I see the following in the index. This seems to be occurring when the caption is created since the extraneous character can be deleted later. For example, insert an image, create a caption, update master doc and its indices.

image description

In the above I have turned on see special characters, note the ‘.’ before the last entry and Map 10. If I re-edit the caption and backspace before the entry Map 10 in the caption that surrounds the image (its frame), a character is there and is deleted, but you cannot see it when editing the document.

Once deleted the index is fine. This is a bug, or was the design point to have extraneous spaces before all entries in any index? And the index fixed below.

image description

It certainly is a bug, report it here with a sample document so that developer can reproduce it at once.

I experimented with right-click and Edit index. In the Type tab, I played with various settings in Create From section. I tried several options for *Display menu.

If choice is References or Category & Number, there is a spurious space before the entry. With Caption Text, there is no extra space before.

It looks like the automatically added text is not well collected during index construction: this space does not exist in the caption, but appears when the “numbering” is requested for the entries. I think the caption system is not the culprit. Suggest the developers to have a look at the index construction machinery.

My config: LO, distro Fedora 31, OS Linux 5.5

Report the bug report number either as an edit to your question or in a comment under my answer as tdf#12345.


@mikekaganski, I would like to disagree. The spurious space or blank seems to be added during caption text creation. My belief is that in AOO the text, along with category header (e.g. Map # …) is inserted before the space, so in that case the space ends up after the text and is of no harm. In LO the text is being appended to what ever text is there, that is after the character, causing the issue which appears in the index.

I myself can remove the character by going into the frame before the generated text (e.g. Map) and clicking a backspace to remove it. When one does so you will notice a slight re-adjustment in the frame, probably due to the affect of the character being removed. If I do, the spurious character no longer appears in the index. So, I am thinking caption text injection has a small bug that appends to what is currently in the frame, instead of inserting at location zero. That is, IMHO.

I am going to mark this solved and open that bug report.

@mikekaganski: brilliant analysis!

@doktoroblivion: warning! “Mike” and “Mike Kaganski” are two different users. I took the liberty to edit your comment.

Instead of opening a new bug report, it is better to add a comment to Mike Kanganski’s report. Click on the link in the first comment.

@ajlittoz: thanks!

@doktoroblivion: I cannot see where you disagree with what I wrote in the bug report I created for this? The problem is that LibreOffice (starting from 5.1) makes the image anchored as image (opposed to previous mode “to paragraph”), making it in line with the caption text; and doing that, it inserts an extra separator between the image and the text (hard break), that is (starting from 5.3) has “hidden” attribute. All that happens at caption creation time, and the character may be removed; what seems wrong to you?

Ok, I understand now, sounds good to me. BTW, thanks for the investigation and bug report. Can you guys up-vote the issue here? Thx