Bug 157829 - Changing character formatting of wrapped RTL/LTR text in LTR/RTL paragraph messes up the wrapping
Summary: Changing character formatting of wrapped RTL/LTR text in LTR/RTL paragraph me...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5.0 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: RTL-CTL
  Show dependency treegraph
 
Reported: 2023-10-19 16:25 UTC by William Friedman
Modified: 2023-10-30 21:21 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
File with text to experiment on (12.49 KB, application/vnd.oasis.opendocument.text)
2023-10-19 16:27 UTC, William Friedman
Details
Video demonstrating the bug (11.66 MB, image/gif)
2023-10-19 16:34 UTC, William Friedman
Details
Bigger video demonstrating the problem (1.62 MB, video/webm)
2023-10-19 16:35 UTC, William Friedman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description William Friedman 2023-10-19 16:25:36 UTC
Description:
If I insert text of the opposite direction to the paragraph direction (i.e., RTL text in an LTR paragraph or LTR text in an RTL paragraph) towards the end of the line, the opposite-direction word correctly wraps to the next line. If, however, I then try to change the formatting of some of the characters of the opposite-direction wrapped word (e.g., bold, italics, strikethrough, etc.), then the word breaks in the middle and stops wrapping.

(I am also experiencing a problem where sometimes undoing the formatting results in the word wrapping correctly again, and sometimes not. I cannot figure out when the wrapping is fixed and when it is not.)

Steps to Reproduce:
1. Type a line of text in whatever the current text orientation is (e.g., English in LTR orientation, Hebrew/Arabic in RTL orientation).
2. As you get towards the end of the line, switch to the opposite orientation language (e.g., if the paragraph is LTR, switch to Hebrew/Arabic; if the paragraph is RTL, switch to English). Type enough letters to wrap the word to the next line.
3. Select several of the characters toward the beginning of the wrapped word. Bold or italicize the text.

Actual Results:
The word stops wrapping to the next line, but splits in the middle.

Expected Results:
The word should continue wrapping on the next line.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.6.2.1 (X86_64) / LibreOffice Community
Build ID: 56f7684011345957bbf33a7ee678afaf4d2ba333
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 1 William Friedman 2023-10-19 16:27:04 UTC
Created attachment 190301 [details]
File with text to experiment on

Here is an example of text on which the problem occurs. To see the bug, select the first few Hebrew letters of the first line and change their formatting, and select the first few English letters of the second line and change their formatting.
Comment 2 William Friedman 2023-10-19 16:34:48 UTC
Created attachment 190302 [details]
Video demonstrating the bug

Here's a video demonstrating the problem. You can see both problems: the initial bold breaks the word wrap, but un-bolding fixes it. But then italicizing breaks the word wrap, but un-italicizing does not fix the wrap. Undo, however, does fix the wrap. The same occurs in with the LTR text in an RTL paragraph, but in that case un-bolding doesn't fix the wrap.
Comment 3 William Friedman 2023-10-19 16:35:50 UTC
Created attachment 190303 [details]
Bigger video demonstrating the problem

Here's the same video above, but in a different format that's larger and easier to see. (VLC can open this format.)
Comment 4 Buovjaga 2023-10-30 18:08:46 UTC
Reproduced already with 5.2 and 3.5.

Arch Linux 64-bit, X11
Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 86f0d88025262b0cfb519545ae7956f6ecea16f9
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 30 October 2023
Comment 5 Eyal Rozenberg 2023-10-30 20:46:56 UTC
Seeing this with:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 3161a6c351a2f5f70c0420ee8cccf2eb23de1ecf
CPU threads: 4; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: he-IL (en_IL); UI: en-US
Calc: threaded

it's weird that the wrapping doesn't even occur at the boundary of the boldfaced text; doing that switches LO to enabling wrapping at an arbitrary point in the Hebrew sequence.

But... the question is, why is that not the behavior in the first place? If I replace the Hebrew sequence with "bcdefghijklmnopqrstuvwxyz", that wraps after the "j" character.
Comment 6 William Friedman 2023-10-30 21:08:02 UTC
Eyal, do you mean that you replaced the sequence אבגדהוזחטיכלמנ after the string of "a"s in the LTR text with "bcdefghijklmnopqrstuvwxyz"? When I do so, that entire sequence of letters wraps as well, as it should. Are you sure you didn't accidentally delete the space after the colon after the last "a"?

The current behavior -- wrapping entire RTL words in LTR sequences just as LTR words are wrapped (and the reverse) is correct; the question is why the wrapping breaks when part of the wrapped RTL word is bolded (or italicized or whatever).
Comment 7 Eyal Rozenberg 2023-10-30 21:21:09 UTC
(In reply to William Friedman from comment #6)
> Eyal, do you mean that you replaced the sequence אבגדהוזחטיכלמנ after the
> string of "a"s in the LTR text with "bcdefghijklmnopqrstuvwxyz"? When I do
> so, that entire sequence of letters wraps as well, as it should. Are you
> sure you didn't accidentally delete the space after the colon after the last
> "a"?

Oh, actually, I did. Good catch, sorry. Let readers also note that, in attachment 190301 [details], there is a space after the "a", so, indeed, the word's characters should be kept together.