Bug 161810 - [DOCX] Justified text does not wrap correctly
Summary: [DOCX] Justified text does not wrap correctly
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:25.2.0 target:24.8.2 target:24...
Keywords: bibisected, bisected, filter:docx, regression
: 162626 (view as bug list)
Depends on:
Blocks: DOCX-Anchor-and-Text-Wrap
  Show dependency treegraph
 
Reported: 2024-06-27 11:07 UTC by Eddie Robson
Modified: 2024-10-18 14:17 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
This shows how the justified text intrudes into the margin. (9.19 KB, image/png)
2024-06-27 11:07 UTC, Eddie Robson
Details
A file affected by the issue. (7.59 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-06-27 12:23 UTC, Eddie Robson
Details
Screenshot of the sample file (OK) (131.77 KB, image/png)
2024-06-27 12:49 UTC, Rafael Lima
Details
New Sample document (16.02 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-06-27 14:29 UTC, Rafael Lima
Details
video testing the bug (21.12 MB, video/webm)
2024-09-29 16:50 UTC, BogdanB
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eddie Robson 2024-06-27 11:07:37 UTC
Created attachment 195000 [details]
This shows how the justified text intrudes into the margin.

Text set to justified in Writer does not wrap properly, and lines will overhang into the margin, seemingly at random. If I change the text to left aligned, usually the part that intrudes into the margin will stay there while the rest of the text adjusts. If I scroll away so that part of the text isn't on the screen, then return to it, the phantom text has usually gone. But if I return the text to justified, the line will again intrude into the margin in the same place. I haven't changed anything in my settings, and this problem has persisted through several updates.
Comment 1 Rafael Lima 2024-06-27 12:11:02 UTC
Is this issue specific to some file? Or does this happen with a new blank file?

Can you share a file where this is happening?

Also, copy and paste your version info. Go to Help - About LibreOffice and then click "Version Information" to copy it.
Comment 2 Eddie Robson 2024-06-27 12:22:55 UTC
Not specific to one file, it affects every new file I create. I've also opened some old ones and it doesn't seem to affect files I created in Word, but older ones created in Libreoffice seem affected. I've only noticed the problem in the past year or so, but I've got files from three years ago which have this problem when I open them now. However, files created more recently seem to suffer from it more severely - I'll upload one.

Version: 24.2.4.2 (X86_64) / LibreOffice Community
Build ID: 51a6219feb6075d9a4c46691dcfe0cd9c4fff3c2
CPU threads: 8; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: en-GB (en_GB); UI: en-GB
Calc: threaded
Comment 3 Eddie Robson 2024-06-27 12:23:24 UTC
Created attachment 195002 [details]
A file affected by the issue.
Comment 4 Rafael Lima 2024-06-27 12:49:19 UTC
Created attachment 195004 [details]
Screenshot of the sample file (OK)

This is what I'm getting after opening the file. It is working as expected.

Now I'm curious as to why this could be happening on your machine.

Have you tried in safe mode? Maybe there's some setting you changed that is causing this (though I couldn't tell which it might be).

https://help.libreoffice.org/latest/lo/text/shared/01/profile_safe_mode.html
Comment 5 Eddie Robson 2024-06-27 13:03:09 UTC
Thanks - I've opened it in safe mode, but I'm afraid I'm still getting the same issue. I'd also note the first line to spill into the margin is slightly below the screenshot you've attached - the lines that end with "want" and "wanted" are both spilling over.
Comment 6 Rafael Lima 2024-06-27 13:05:47 UTC
(In reply to Eddie Robson from comment #3)
> Created attachment 195002 [details]
> A file affected by the issue.

Forget about my previous comment... if I scroll down I see the issue in the line 

"As the minutes went by, with no response, I regretted sending the message. I didn’t really want to have an argument about it. I would apologise next time I saw him."

Repro with

Version: 24.2.3.2 (X86_64) / LibreOffice Community
Build ID: 420(Build:2)
CPU threads: 16; OS: Linux 6.8; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Ubuntu package version: 4:24.2.3-0ubuntu0.24.04.2
Calc: threaded
Comment 7 Eddie Robson 2024-06-27 13:07:41 UTC
Yeah - it's very inconsistent, there's no logic to it I can see. Sometimes a long block of text won't have any errors, then there'll be several close together.
Comment 8 Rafael Lima 2024-06-27 14:29:40 UTC
Created attachment 195006 [details]
New Sample document

I was suspecting the issue had something to do with your file. So I did the following:

1) Opened your sample file in MS Word
2) Copied all the text
3) Created a new blank Word file and pasted the text as pure text (no formatting)
4) I applied the formatting manually (Liberation Serif, double spacing)
5) Saved the file as DOCX
6) Opened it in LO Writer... now I get the issue, but on different sentences.

So the problem is nothing to do with your file. It is possibly related to DOCX import.

I've just attached the newly created sample file.
Comment 9 Eddie Robson 2024-06-27 14:45:09 UTC
Thank you. I think you might be onto something - I just opened a bunch of different documents from my older files to see what happened, and the error doesn't seem to occur on the .docs but it does on all the .docxs.
Comment 10 Justin L 2024-08-24 14:44:16 UTC
This started in 24.2 with commit 7d08767b890e723cd502b1c61d250924f695eb98
Author: László Németh on Mon Oct 16 19:39:30 2023 +0200
    tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt.
Comment 11 Justin L 2024-09-04 12:06:25 UTC
For both "Answers On A Postcard.docx" and "Answer2.docx", it looks like the problem is only affecting the first line of the paragraph. Other similar bug reports have reported similar problems against the last line.
Comment 12 László Németh 2024-09-16 13:18:24 UTC
Proposed fix: https://gerrit.libreoffice.org/c/core/+/173451
Comment 13 Commit Notification 2024-09-17 07:19:06 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/857dd6000c877f2c6d8bb73806a8557fa0baea73

tdf#161810 sw smart justify: fix overhanging lines containing tabs

It will be available in 25.2.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 László Németh 2024-09-17 07:40:57 UTC
Fixed in master, started back-port in 24.8.

@Eddie Robson and all: thanks for the report and feedback!
Comment 15 Commit Notification 2024-09-19 05:27:36 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/62200a1859f6389e930b9c9ca154f1fd36162be4

tdf#161810 sw smart justify: fix overhanging lines containing tabs

It will be available in 24.8.2.

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 16 BogdanB 2024-09-29 16:50:37 UTC
Created attachment 196781 [details]
video testing the bug

I built LibreOffice today, and this is what I get after pressing a tab in the first line.

Now seems to be a problem inside the page margin. 

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 9e5321f46d175e827924a8040f6325cdcd7d751f
CPU threads: 16; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 17 BogdanB 2024-09-29 16:51:01 UTC
I was using Rafael file from comment 8.
Comment 18 Rafael Lima 2024-09-29 18:57:45 UTC
(In reply to BogdanB from comment #16)
> I built LibreOffice today, and this is what I get after pressing a tab in
> the first line.
> 
> Now seems to be a problem inside the page margin. 

I get the exact same behavior as in the video.

@Laszlo, can you take a look at this? Should we file a separate ticket for this issue?
Comment 19 László Németh 2024-09-29 19:08:52 UTC
(In reply to Rafael Lima from comment #18)
 
> @Laszlo, can you take a look at this? Should we file a separate ticket for
> this issue?

Yes, I can. Yes, you should. Thanks in advance!

@Bogdan, Rafael: also thanks for the bug report and feedback!
Comment 20 Xisco Faulí 2024-10-04 07:26:50 UTC
(In reply to Rafael Lima from comment #18)
> (In reply to BogdanB from comment #16)
> > I built LibreOffice today, and this is what I get after pressing a tab in
> > the first line.
> > 
> > Now seems to be a problem inside the page margin. 
> 
> I get the exact same behavior as in the video.
> 
> @Laszlo, can you take a look at this? Should we file a separate ticket for
> this issue?

Hi Rafael,
Has this issue been reported in a follow-up ticket ?
Comment 21 Commit Notification 2024-10-04 07:28:06 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

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

tdf#161810 sw smart justify: fix overhanging lines containing tabs

It will be available in 24.2.7.

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 22 Justin L 2024-10-18 14:17:54 UTC
*** Bug 162626 has been marked as a duplicate of this bug. ***