Bug 101534 - EDITING: paragraph in specific document (content from external source?) changes indent when copying and pasting from and to same paragraph
Summary: EDITING: paragraph in specific document (content from external source?) chang...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:6.2.0 target:6.1.1
Keywords:
Depends on:
Blocks: Paste Paragraph-Indent
  Show dependency treegraph
 
Reported: 2016-08-15 07:58 UTC by Anton Derbenev
Modified: 2018-07-27 09:17 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
open this file, add text, copy and paste it; paragraph indents! (9.36 KB, application/vnd.oasis.opendocument.text)
2016-08-15 07:58 UTC, Anton Derbenev
Details
Sample ODT (12.84 KB, application/vnd.oasis.opendocument.text)
2018-07-11 22:10 UTC, Aron Budea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Derbenev 2016-08-15 07:58:03 UTC
Created attachment 126837 [details]
open this file, add text, copy and paste it; paragraph indents!

1. Open attachment
2. Add any (unformatted) text – 1 character is enough
3. Copy or cut it, and then paste to same place or nearby

What happens: paragraph indents
(it's very unexpected; furthermore, I found no way how to reformat paragraph so it keeps 0 indent when copying & pasting)

longer history:
Yesterday my farther shown me document he edited and asked how to avoid this indenting when cutting piece of text and pasting to same paragraph. Document is research – mostly typed text, with some fragments copied from internet.

After some messing around, I found that copying this paragraph to new document with default template keeps the issue. Even more, there is no way to avoid this effect, even by applying default formatting (Ctrl+M) and re-adjusting indent back to 0 (it keeps re-indenting after paste).

Animation with example: http://imgur.com/6SXm43Z

Tested on 4.1.6, 5.1.2, 5.1.4, 5.1.5, 5.2.0 – on Windowses 7 and 10 (32 and 64-bit)
Comment 1 Cor Nouws 2016-08-22 09:08:13 UTC
Hi Anton,

Thanks for the report!

I confirm what you see. in a recent daily build and in LibreOffice 3.3.0.4

The problem is in the first paragraph that has indent first and next lines set as direct formatting.

Hit Ctrl+M (Format > Clear direct formatting) *before* typing and you see what I mean.

I guess there is some corrupt attribute in the paragraph that causes the unexpected behavior with copy/paste, that you describe. Can happen when copy paste from the Internet.. You may be able to find that when you look into the xml files (unzip the odt to it's components.)

Ciao - Cor
Comment 2 Aron Budea 2018-07-11 22:10:07 UTC
Created attachment 143493 [details]
Sample ODT

I've got a very similar bug.
The attached sample was taken from a DOCX, sanitized and saved as ODT (the format doesn't seem to matter, the original document probably went through a couple of Writer-Word rountrip).

- Open the document.
- Select and copy the first paragraph ("Lorem ... efficiantur.").
- Paste it at the end of the document.

=> The last paragraph gets unexpectedly indented to the left.

Selecting the whole document and clearing direct formatting reveals this strange indentation, but the style doesn't seem to reflect it, and changing the style doesn't fix it, either.

Observed using LO 6.1.0.1 & 3.4.0.1 / Ubuntu 17.10.
In 3.3.0 the copy-pasting doesn't mess up formatting, but otherwise behaves the same way.
Comment 3 Miklos Vajna 2018-07-19 08:28:12 UTC
(In reply to Aron Budea from comment #2)
> => The last paragraph gets unexpectedly indented to the left.

The numbering has a negative left indent, but a direct formatting resets it back to 0. Now this direct formatting is lost during paste. This looks inconsistent with other per-paragraph properties, e.g. if you paste from a left-aligned paragraph to a centered one, then the centered property is kept.

I'll take a look.
Comment 4 Commit Notification 2018-07-19 15:46:46 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=340eaa6aa15c18cc2696a4a304350810cb36565c

tdf#101534 sw: fix lost indent attributes when copying into numbered paragraph

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Aron Budea 2018-07-20 11:45:15 UTC
Verified with both samples. Thanks for the fix, Miklos!

Version: 6.2.0.0.alpha0+
Build ID: af3a976ab355b8e67f91a6223427bf967fdaefff
CPU threads: 16; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: en-US (en_US.UTF-8); Calc: group threaded
Comment 6 Commit Notification 2018-07-27 09:17:32 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=93dce15827cc8bd69a9abb5e70a5df0292719a9a&h=libreoffice-6-1

tdf#101534 sw: fix lost indent attributes when copying into numbered paragraph

It will be available in 6.1.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.