Bug 159101 - Cross-reference to referenced text causing a space at the beginning of a line
Summary: Cross-reference to referenced text causing a space at the beginning of a line
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.6.0.0 beta1+
Hardware: All All
: medium normal
Assignee: Matthew Kogan
URL:
Whiteboard: target:24.8.0 target:24.2.1 target:7.6.5
Keywords:
: 158680 159613 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-01-10 11:57 UTC by Matthew Kogan
Modified: 2024-03-08 12:08 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
This is how I interpreted the description of the bug. (11.48 KB, application/vnd.oasis.opendocument.text)
2024-01-15 11:21 UTC, Ludovica
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Kogan 2024-01-10 11:57:51 UTC
Description:
A cross-reference inserted in a justified paragraph, with a space in the referenced text, broken across a line boundary, causes a space to appear at the beginning of the new line.

Steps to Reproduce:
1. Create a paragraph with the text "one two"
2. Select "one two" and insert a bookmark
3. Create a new paragraph with a nearly full line of text, with enough space at the end for "one" but not for "one two"
4. Set the paragraph to be justified
5. Insert a cross-reference to the bookmarked paragraph at the end of the line, selecting "Referenced text" for "Refer using".

Actual Results:
The "two" on the second line has a space before it.

Expected Results:
There should be no space before the "two".


Reproducible: Always


User Profile Reset: No

Additional Info:
This did not happen in 6.2.4 (the version I was hoping to upgrade from).
Comment 1 Matthew Kogan 2024-01-11 21:57:33 UTC
This was caused by https://gerrit.libreoffice.org/c/core/+/152274 so CCing Michael Stahl.
Comment 2 Matthew Kogan 2024-01-12 12:07:42 UTC
Also CCing Caolán McNamara.
Comment 3 Ludovica 2024-01-15 11:21:28 UTC
Created attachment 191946 [details]
This is how I interpreted the description of the bug.

NO Repro with:
Version: 7.6.0.0.beta1 (X86_64) / LibreOffice Community
Build ID: be55b15d98c5f059483845a183fcb5ea8023d27c
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: it-IT (it_IT); UI: it-IT
Calc: CL threaded

I don't know if I should call it a bug at all... the space you say before 'two' is the same as the one on the bookmark, it doesn't create an additional one. Everything works fine for me, just let me know if the file I uploaded reproduces the error you reported or if I did something wrong.
Comment 4 Matthew Kogan 2024-01-15 11:31:02 UTC
Surely the space is unnecessary now that the second word is on a new line. This is new behaviour in 7.6 and looks awful to me. If nothing else, why does it only do this when the paragraph alignment is set to justified?
Comment 5 Commit Notification 2024-01-17 10:45:45 UTC
Matthew Kogan committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4cdb542348b20d8a558cd6413c7cccdc50241fa9

tdf#159101 sw: Fix space appearing at start of line when field wraps

It will be available in 24.8.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 6 Commit Notification 2024-01-17 14:24:23 UTC
Matthew Kogan committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

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

tdf#159101 sw: Fix space appearing at start of line when field wraps

It will be available in 24.2.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 7 Commit Notification 2024-01-17 19:28:03 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

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

tdf#159101: sw_layoutwriter: Add unittest

It will be available in 24.8.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 8 Xisco Faulí 2024-01-17 19:38:50 UTC
I think we can close this issue as FIXED.
@Matthew, thank you very much for fixing it
Comment 9 Commit Notification 2024-01-17 19:39:08 UTC
Matthew Kogan committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

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

tdf#159101 sw: Fix space appearing at start of line when field wraps

It will be available in 7.6.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 10 Mike Kaganski 2024-02-07 10:36:11 UTC
*** Bug 159613 has been marked as a duplicate of this bug. ***
Comment 11 Michael Stahl (allotropia) 2024-03-08 12:08:01 UTC
*** Bug 158680 has been marked as a duplicate of this bug. ***