Bug 98682 - Wrong text direction after copy/paste from web browser to LibreOffice
Summary: Wrong text direction after copy/paste from web browser to LibreOffice
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.1.1.3 release
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: HTML-Paste RTL
  Show dependency treegraph
 
Reported: 2016-03-15 14:06 UTC by yousifjkadom
Modified: 2024-08-03 09:15 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
1 (7.18 KB, application/zip)
2016-03-15 14:06 UTC, yousifjkadom
Details
2 (23.29 KB, application/vnd.oasis.opendocument.text)
2016-03-15 14:07 UTC, yousifjkadom
Details
2 (23.29 KB, application/vnd.oasis.opendocument.text)
2016-03-15 14:12 UTC, yousifjkadom
Details
misalignment (7.58 KB, application/zip)
2016-03-23 09:44 UTC, yousifjkadom
Details
Table (5.32 KB, application/zip)
2016-03-23 16:08 UTC, yousifjkadom
Details
video showing the bug and the workaround (1.43 MB, video/webm)
2016-03-23 19:01 UTC, Usama
Details

Note You need to log in before you can comment on or make changes to this bug.
Description yousifjkadom 2016-03-15 14:06:54 UTC
Created attachment 123595 [details]
1

Hi.

Take any page in internet like:

http://www.libreoffice.org/about-us/who-are-we/

Now I copy/past from this page (from firefox 45.0 windows) to LibreOffice writer. I save 1st time as docx. file (attachment-1) & at 2nd trial as odt. file (attachement-2)

In both cases there is error in alignment. Originaly contents align as "left to right", but it appear in docx. & odt. aligned from right to left !!

I produce this old bug in the following condition:

- Windows 7 X 64 bit SP1 OS (English USA not Arabic user interface)
- Windows 7 system locate is Arabic (UAE)
- Windows 7 OS input language: is English USA
- LibreOffice version 5.1.1 (fresh release) windows version.
- LibreOffice language setting are as follow:
  - user interface: Arabic (Sudi Arabia)
  - local setting: default - Arabic UAE
  - default language for western documents: default - English USA
  - Complex Text Layout (CTL): default - Arabic (UAE)
  - default direction of text in libreOffice /file, formating, page/ is "from right to left" (BUT PLEASE NOTICE THAT I CHANGE IT FROM ICON IN TALL FORMATING BAR TO "FROM RIGHT TO LEFT" BEFORE PAST CONTENTS OF WEB PAGE)
Comment 1 yousifjkadom 2016-03-15 14:07:50 UTC
Created attachment 123596 [details]
2
Comment 2 yousifjkadom 2016-03-15 14:12:46 UTC
Created attachment 123597 [details]
2
Comment 3 yousifjkadom 2016-03-15 14:14:09 UTC
Sorry. Technical error: file (2) attached 2 times. Please delete on of them
Comment 4 Usama 2016-03-22 21:13:17 UTC
Unable to reproduce.

Text in UAE or Any Arabic or RTL local (tested with Hebrew local) is set from Right to Left by default. so any text pasted will get that direction from RTL.

You said you changed it from RTL. So I did I changed it to LTR and pasted the text and saved it to both docx and odt. I reopened the file and everything seems ok. No problem.

Could you please clear the steps you followed?

Also, it would be so useful if you can install a version from our daily build and test with it as the bug could have been fixed

http://dev-builds.libreoffice.org/daily/master/win-x86@39/current/

You can also visit us on IRC to discuss your issue: https://wiki.documentfoundation.org/QA/IRC

I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
Comment 5 Usama 2016-03-22 21:34:25 UTC
tested on both Windows and Linux 5.2.0.alpha
Comment 6 yousifjkadom 2016-03-23 09:43:51 UTC
Hi. Look to this vedio carefully. 

https://drive.google.com/file/d/0B1nB8I_1Xoa3bExtTkF5WF9icFk/view?usp=sharing

I inforced to upload it to Google drive because it's larg size (about 16 MB)

Download it then view it by VLC player.

I attached also the misalignment docx. file that created in this step.

Test done on version 5.1.1.3 fresh release.

Best
Comment 7 yousifjkadom 2016-03-23 09:44:40 UTC
Created attachment 123787 [details]
misalignment
Comment 8 Usama 2016-03-23 09:59:31 UTC
Dear Yosuif,

Thank you for providing the video, I confirm the bug you saw on one of my systems.

I did not investigate it further because you said " Originaly contents align as "left to right", but it appear in docx. & odt. aligned from right to left !!"
so I thought you are talking about change after saving the document that is related to docx or odt.

The LTR button only seems to effect the first line. But if you select All the text and press LTR button then every thing will get in shape. your problem is mainly the pasted texts gets misaligned before even saving it. Right?

I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested info is provided.
Comment 9 yousifjkadom 2016-03-23 11:33:31 UTC
I change it to UNCONFIRMED.
Comment 10 yousifjkadom 2016-03-23 11:36:14 UTC
By the way, can you attached video? Do you need it further online? Can I delete it, or better to put it for longer time & for how long?
Comment 11 Usama 2016-03-23 13:21:04 UTC
No need for video link you can remove it. but you did not answer my question.

Your problem is not related to file saving, right? It happen even before saving.
Also if you selected all the text and chose LTR from the toolbar there would be no problem right?

I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested info is provided.
Comment 12 yousifjkadom 2016-03-23 15:44:32 UTC
Hi.

1)"Your problem is not related to file saving, right? It happen even before saving."

Yes, you are right.

2)"Also if you selected all the text and chose LTR from the toolbar there would be no problem right?"

What you mean by "if you select all text ...."? Do you mean selection of all text inside docx. file AFTER copy/past contents from web page to it ?? Is this what you mean?? If this what you mean, so yes it is. Yes whether this done before saving docx. or after reopining it after saving it.
Comment 13 yousifjkadom 2016-03-23 16:07:44 UTC
By the way. I discover something & I'm not sure whether it should be put in new bug or included here. But even if it should be put in new bug, it is related to this bug.

Please open this link:

http://xubuntu.org/news/inxi/

I copy/past contents of 1st TABLE to LibreOffice docx. (after click on LTR icon in talbar) & same bug (bug 98682) in this thread occur. But new things are:

1- Table oriented completely wrong & CAN NOT CORRECTED by select all then press on "LTR icon" from toolbar. I can not correct it unless by creating new column on side of my left hand then copy/past what are on extrime right to corresponding location in new column then delete at most right column then resize new left column width.

2- After copy/past, I try to save docx. for 1st time but it crushed! Recovery windows open to me ask for recovery or not. I attached the file (attached file "Table" docx.). But this attached file I get it after giving "O.K" for recovery then saving it.
Comment 14 yousifjkadom 2016-03-23 16:08:59 UTC
Created attachment 123795 [details]
Table
Comment 15 Usama 2016-03-23 16:21:24 UTC
I confirm that text pasted in document with default RTL local (Arabic - Hebrew ..) has misalignment problems. If you set the direction to be LTR and paste a LTR text, only the first line will be aligned correctly to LTR.

Other lines will be from RTL and it will be justified without any specific reason.

It does not effect 5.0.2 Ubuntu 15.10 but effects 5.2.0.0.alpha for me.

Workaround:
Ctrl+Shift+A (RTL) (LTR) button can fix this by selecting the whole text then change the direction between RTL-LTR. the text will get right direction and text unjustified justification will disappear.

Version: 5.2.0.0.alpha0+
Build ID: aaca25d67eb5ea252730cdcf555ecc04ce04a5e6
CPU Threads: 4; OS Version: Linux 4.2; UI Render: default; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2016-02-24_23:58:47
Locale: en-US (en_US.UTF-8)
OS: Ubuntu 15.01

Version: 5.2.0.0.alpha0+
Build ID: 6eb7cd38e348e8a9d6498bfc2d41e91725eb34aa
CPU Threads: 1; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-03-16_12:53:35
Locale: en-US (en_US) OS: Windows 7 Enterprise

Version: 5.0.2.2
Build ID: 00m0(Build:2)
Locale: en-GB (en_US.UTF-8)
Comment 16 Usama 2016-03-23 16:31:23 UTC
(In reply to yousifjkadom from comment #13)

> I copy/past contents of 1st TABLE to LibreOffice docx. (after click on LTR
> icon in talbar) & same bug (bug 98682) in this thread occur. But new things
> are:
> 
> 1- Table oriented completely wrong & CAN NOT CORRECTED by select all then
> press on "LTR icon" from toolbar. I can not correct it unless by creating
> new column on side of my left hand then copy/past what are on extrime right
> to corresponding location in new column then delete at most right column
> then resize new left column width.
> 

You can workaround this by selecting the table >> right click >> table properties >> from table tab >> Properties (text direction) >> set Left-to-Right

regarding the crash, if you can reproduce it with clear steps, open a separate bug for it.

I suggest you visit us on IRC to discuss some of the bugs, I can talk in Arabic if you want.

just one link to chat from here: https://wiki.documentfoundation.org/QA/IRC
Comment 17 yousifjkadom 2016-03-23 17:46:39 UTC
Hi Usama.

"You can workaround this by selecting the table >> right click >> table properties >> from table tab >> Properties (text direction) >> set Left-to-Right"

No! You are wrong! You misunderstad me again. I do not mean "text direction"! I mean text LOCATION regardless direction. Please look to table in web site carefully: 

   It consisting from 2 vertical columns & 6 horizontal rows. Ignore raws & text direction & concetrate on 2 VERTICAL COLUMN. Originaly in the web page we have narrow column on your left hand & wide column on your right hand. Now look to table in docx. file. In docx. narrow column (which should be on left) it appear on right side, while wide column (which should be on right) appearing at left!! I mean table in docx. is flipped in such a way that column on right become at left & column on left become at right (in addition to bug 98682 of text direction that already confirm it). I attached this file to see NEW "flipping bug of vertical columns of table that I just discovering.
Comment 18 Usama 2016-03-23 18:20:44 UTC
(In reply to yousifjkadom from comment #17)
> No! You are wrong! You misunderstad me again. I do not mean "text
> direction"! I mean text LOCATION regardless direction. Please look to table
> in web site carefully: 
> 


When I do the steps I told you it flip the location too. have you tried it?
You will have to change direction in separate step using the LTR button.
Comment 19 yousifjkadom 2016-03-23 18:49:46 UTC
I did what you ask me to do:

"selecting the table >> right click >> table properties >> from table tab >> Properties (text direction) >> set Left-to-Right"

It failed completely & table remain flipped. Only correct text direction but not location of columns
Comment 20 Usama 2016-03-23 19:01:04 UTC
Created attachment 123797 [details]
video showing the bug and the workaround

Check the video please. It's on Windows but I did similar on Linux
Comment 21 yousifjkadom 2016-03-23 20:53:06 UTC
I did this but did not work at all!!

After your video I repeat it without any result! Flipping remain as it without correction. This is on windows 7 SP1 X64 bit with version 5.1.1.3 Fresh release.

I see in video that your LibreOffice user interface differ from me. Is this video on windows? If yes, please use same setting that I using: 

- Windows 7 X 64 bit SP1 OS (English USA not Arabic user interface)
- Windows 7 system locate is Arabic (UAE)
- Windows 7 OS input language: is English USA
- LibreOffice version 5.1.1 (fresh release) windows version.
- LibreOffice language setting are as follow:
  - user interface: Arabic (Sudi Arabia)
  - local setting: default - Arabic UAE
  - default language for western documents: default - English USA
  - Complex Text Layout (CTL): default - Arabic (UAE)
  - default direction of text in libreOffice /file, formating, page/ is "from right to left" (BUT PLEASE NOTICE THAT I CHANGE IT FROM ICON IN TALL FORMATING BAR TO "FROM RIGHT TO LEFT" BEFORE PAST CONTENTS OF WEB PAGE)
Comment 22 QA Administrators 2017-05-22 13:20:18 UTC Comment hidden (obsolete)
Comment 23 Yousuf Philips (jay) (retired) 2017-10-13 21:11:50 UTC
No repo on Windows 8.1 with Firefox 54 and LO 6.0.

Version: 6.0.0.0.alpha0+
Build ID: 4d1ee296def5fde9c77702d3d19d76be33cbdaad
CPU threads: 4; OS: Windows 6.3; UI render: default; 
Locale: en-US (en_US); Calc: group

No repo on Linux Mint 18 with Firefox 55 and LO 6.0.

Version: 6.0.0.0.alpha0+
Build ID: 3672cdd35985201ea87463cf032fedd02c052f4d
CPU threads: 2; OS: Linux 4.4; UI render: default; VCL: gtk2; 
Locale: en-US (en_US.UTF-8); Calc: group
Comment 24 Omer Zak 2017-11-12 13:57:52 UTC
Still happens in:

Version: 6.0.0.0.alpha1+
Build ID: 5d12237d79f289a1dcf8e07aa03df329e136f078
CPU threads: 8; OS: Linux 4.9; UI render: default; VCL: gtk3; 
Locale: en-US (en_US.utf8); Calc: group

OS: Debian 64bit Stretch (Debian 9.2, with some backported packages)


1. I did not reproduce the crash when trying to save the inxi page after pasting it into an empty document.
2. I tested by setting the default style to RTL and then pasting the inxi page into an empty Writer document. The text was pasted as RTL. Pressing the LTR button affected only the first line of the text.

I'd like to see a clarification:
When copying and pasting text into LibreOffice Writer, is it true that the pasted text is always supposed to retain LTR/RTL directionality of the original text?
Comment 25 Dina 2018-09-17 21:18:26 UTC
Still happens (including the workarounds) in Libreoffice 6.1.1.2
Build ID: 1:6.1.1~rc2-0ubuntu0.18.04.1~lo3
CPU threads: 1; OS: Linux 4.15; UI render: default; VCL: gtk2; 
Locale: he-IL (en_US.UTF-8); Calc: group threaded

Web page contents copied using Firefox 62.0
Comment 26 QA Administrators 2019-09-18 02:54:37 UTC Comment hidden (obsolete)
Comment 27 yousifjkadom 2019-09-18 18:23:54 UTC
Hi dear. 

I test this on last version but on Linux (Fedora 30 X64 bit). I have no Windows OS further. I'm now pure Linux user.

On Fedora Linux this bug is still existing 100% without any improvement at all inspite of long time since it was opened !
Comment 28 yousifjkadom 2019-09-18 18:26:54 UTC
Please notice that I test it on both system LO & (AppImage package last version)
Comment 29 QA Administrators 2021-09-18 03:27:46 UTC Comment hidden (obsolete)
Comment 30 ⁨خالد حسني⁩ 2022-09-25 14:33:27 UTC
I think this a feature, not a bug. When opening a blank document in an RTL locale, the default page style will have direction set to Right To Left, and paragraph direction is not explicitly set. This, I think, under the assumption that if you are using an RTL locale you are most likely to be creating RTL documents. The reverse is true as well, if the locale is LTR the page direction will be LTR.

The best fix is for the user to set the page direction explicitly, or when mixing RTL and LTR text, set the direction of the paragraphs.

We can try to detect paragraph direction based in the pasted content, but this seems to be a fragile thing to do (what if one is pasting into an existing paragraph).

Alternatively we might want an “auto” paragraph direction setting that uses the direction from the paragraph content, but that is a much bigger change.

My suggestion is to close as NOTABUG.