Bug 133104 - Anchor To Character not persistent
Summary: Anchor To Character not persistent
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.0.0.0.alpha1+
Hardware: All All
: high major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Anchor-and-Text-Wrap
  Show dependency treegraph
 
Reported: 2020-05-16 21:18 UTC by Telesto
Modified: 2022-05-24 01:27 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (465.97 KB, application/vnd.oasis.opendocument.text)
2020-05-16 21:19 UTC, Telesto
Details
Screencast (4.94 MB, video/mp4)
2020-05-16 21:20 UTC, Telesto
Details
Example file without Headings (471.62 KB, application/vnd.oasis.opendocument.text)
2020-05-17 08:17 UTC, Telesto
Details
Example file with chart and keep inside text boundaries on (32.54 KB, application/vnd.oasis.opendocument.text)
2020-05-17 08:34 UTC, Telesto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2020-05-16 21:18:57 UTC
Description:
Text layout, multitude an outcomes

Steps to Reproduce:
1. Open the attached file
2. Delete the colored paragraph blocks one by one.. from bottom to top
3. Notice how the image is pressed down (when deleting the yellow
4. The Heading gets to first page when deleting purple
5. The heading drops back to second page when select the green
6. How undo everything walks back
7. How redo generates a different result
8. How Save & file reload changes it again (with the cat over the 

Actual Results:
Unpredictable outcome

Expected Results:
Bit more consistent


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.0.0.0.alpha1+ (x64)
Build ID: f9790da286f2d2fa47f1748f8cfa6172c6622ca3
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win; 
Locale: de-CH (nl_NL); UI: en-US
Calc: CL
Comment 1 Telesto 2020-05-16 21:19:15 UTC
Created attachment 160914 [details]
Example file
Comment 2 Telesto 2020-05-16 21:20:48 UTC
Created attachment 160915 [details]
Screencast
Comment 3 Telesto 2020-05-16 21:54:30 UTC
@UX-advise
Can Image -> Type -> Keep inside text boundaries be ticket by default. 
It's a major unpredictable layout mess without

For the record: the problem is not limited to image, and not limited to anchoring to character. Anchor to paragraph is functioning little better.. but dragging shapes around is far superior to having it not enabled: Expect it's called Follow Text flow (or is this something different compared to Keep inside text boundaries)

The only problem right know: bug 113373
Comment 4 Jim Raykowski 2020-05-17 05:28:14 UTC
Yep, this is what I struggled with for outline folding enhancement https://bugs.documentfoundation.org/show_bug.cgi?id=38093#c73

One thing that seems to work is to not have the text flow attribute 'Keep with next paragraph' set for headings.
Comment 5 Telesto 2020-05-17 08:17:49 UTC
Created attachment 160920 [details]
Example file without Headings
Comment 6 Telesto 2020-05-17 08:34:40 UTC
Created attachment 160922 [details]
Example file with chart and keep inside text boundaries on

Keep inside text boundaries isn't helpful here. Broken position with or without
Comment 7 Telesto 2020-05-17 08:44:30 UTC
I created also a version with a shape(square) object behaviour moving is again different and causing a layout loop.. similar to this bug 133075
Comment 8 Telesto 2020-05-17 19:35:18 UTC
@Justin
Rather opportunistic: You did few sw layout changes lately .. Any knowledge about the inner workings of anchoring of objects & lay-outing in LibreOffice itself? More interested in some insight; not a straight away bug fix ;-)

It appears the the same anchor + same wrap is still able to produce different results depending on object (shape/frame/image/chart etc). Example bug 133075

[In simple World I expect the position of objects to be based on shared code as far as possible. However the behavior suggests otherwise.. ]

The issue with images (shown in this bug) can be 'masked' by checking "Keep inside text boundaries". However the trick doesn't work for shapes/frames/charts..

This must be noticeable in MSO import?
Comment 9 Telesto 2020-05-17 19:35:49 UTC Comment hidden (obsolete)
Comment 10 Heiko Tietze 2020-05-18 08:17:47 UTC
Images anchored To Character are expected to stay at the anchor and the relative position (if the character moves left/right you want the image to stay at the same position). It's definitely not expected that anchor moves when paragraphs somewhere else are deleted.
Comment 11 QA Administrators 2022-05-22 03:42:53 UTC Comment hidden (obsolete)
Comment 12 Telesto 2022-05-22 07:50:59 UTC
Still repro
Version: 7.4.0.0.alpha1+ / LibreOffice Community
Build ID: 62531ec1091c7b3f6a3577889a18234790ec716d
CPU threads: 8; OS: Mac OS X 12.3.1; UI render: default; VCL: osx
Locale: nl-NL (nl_NL.UTF-8); UI: en-US
Calc: threaded
Comment 13 Telesto 2022-05-22 07:56:07 UTC
(In reply to Heiko Tietze from comment #10)
> Images anchored To Character are expected to stay at the anchor and the
> relative position (if the character moves left/right you want the image to
> stay at the same position). It's definitely not expected that anchor moves
> when paragraphs somewhere else are deleted.

If you delete the highlighted block in pieces the text will shift down (so first yellow, next red, next green). If you delete it at once it will look different. It also isn't restored on save and reload
Comment 14 sdc.blanco 2022-05-22 09:06:00 UTC
Bug summary says "Anchor to Character is not persistent"
What does that mean in the context of the example?

I think you are not satisfied with the image positioning, but you do not specify what you are expecting or trying to do.  Maybe you should be try ask.libreoffice.org first?

Otherwise -- for example -- change your Vertical position setting to:

Center  to Character   and see what happens.  ("to character" anchor by itself does not control positioning. There are many variations and possibilities in the options, so this must also be specified.  The "chaos" you report may simply be a misunderstanding of the operation of those options.
Comment 15 Mike Kaganski 2022-05-23 07:09:21 UTC
Is the problem here that "to Margin" behaves as if it were "to Paragraph text area"? This is only a bug of documentation, that doesn't clearly explain what "Margin" in vertical positioning means for "to character" anchoring [1].

Namely, it tells:

> * Margin: Depending on the anchoring type, the object is positioned considering the space between the top margin and the character ("To character" anchoring) ...

The "top margin of what" is not explained here. In fact, the "Margin" in the UI corresponds to ODF's 'style:vertical-rel="paragraph"' (as opposed to 'style:vertical-rel="paragraph-content"' for "Paragraph text area"; see [2]). Both "Margin" and "Paragraph text area" mean "relative to paragraph" - just to different points of the paragraph: for text area, that excludes the paragraph's borders and padding.

This works as designed, completely correctly as far as I see it. Possibly it would benefit from the "Margin" being renamed to "Paragraph area" or "Complete paragraph area" ...

[1] https://help.libreoffice.org/7.3/en-US/text/swriter/01/05060100.html?DbPAR=WRITER#bm_id1466719
[2] https://docs.oasis-open.org/office/OpenDocument/v1.3/OpenDocument-v1.3-part3-schema.html#property-style_vertical-rel
Comment 16 Mike Kaganski 2022-05-23 07:18:45 UTC
One edge case might still be considered a bug: when the anchor character needed to get to the previous page, but the image couldn't then fit to that previous page, thus preventing the move of the line to the previous page. In that case, the expected outcome would be all the previous lines of the paragraph to stay on the previous page, the line with anchor stay on the next page, and simply some white space appear in the bottom of the previous page. The actual result (the bug IMO) currently is that in this case, the *whole paragraph* jumps to the next page, and stays there until there's room on the previous page to accommodate the image.

I'd say, to make it clean, the latter issue needs an own bug report, and there it would need a check if that was always so, or if it is a regression.
Comment 17 sdc.blanco 2022-05-23 10:07:56 UTC
(In reply to Mike Kaganski from comment #15)
> Is the problem here that "to Margin" behaves as if it were "to Paragraph
> text area"? 
> This is only a bug of documentation,
It does behave in that way if there is no border and padding in the paragraph, which seems to be the case in the test attachments.  

But I agree that the documentation for Margin needs improvements.

> > * Margin: Depending on the anchoring type, 
afaict -- there is no difference in the vertical positioning with "To Paragraph" and "To Character" (at least in my tests).  Do you know a case where they are different?

> The "top margin of what" is not explained here. 
If the "dependency" in anchoring type can be dropped, then "Margin" can be explained as: 
  between top and bottom edges [or borders] of paragraph where anchor is located.

> Possibly ... "Margin" being renamed to "Paragraph area" or
> "Complete paragraph area" ...
Good idea.  Propose:

"Entire paragraph"  (to be parallel with "Entire Page" and "Entire Frame")
Comment 18 Telesto 2022-05-23 10:31:12 UTC
(In reply to Mike Kaganski from comment #16)
> One edge case might still be considered a bug: when the anchor character
> needed to get to the previous page, but the image couldn't then fit to that
> previous page, thus preventing the move of the line to the previous page. In
> that case, the expected outcome would be all the previous lines of the
> paragraph to stay on the previous page, the line with anchor stay on the
> next page, and simply some white space appear in the bottom of the previous
> page. The actual result (the bug IMO) currently is that in this case, the
> *whole paragraph* jumps to the next page, and stays there until there's room
> on the previous page to accommodate the image.
> 
> I'd say, to make it clean, the latter issue needs an own bug report, and
> there it would need a check if that was always so, or if it is a regression.

I moved it to bug 149241. Not sure if the title is adequate, feel free to modify.
Comment 19 Mike Kaganski 2022-05-23 10:40:50 UTC
(In reply to sdc.blanco from comment #17)
> > > * Margin: Depending on the anchoring type, 
> afaict -- there is no difference in the vertical positioning with "To
> Paragraph" and "To Character" (at least in my tests).  Do you know a case
> where they are different?

Unfortunately I don't know, and can't read the related code at the moment. But I assume that you are correct, and it should be simply unified. I'd suggest to do the change.

> Propose:
> 
> "Entire paragraph"  (to be parallel with "Entire Page" and "Entire Frame")

+1
Comment 20 sdc.blanco 2022-05-24 01:27:49 UTC
(In reply to Mike Kaganski from comment #19)
> (In reply to sdc.blanco from comment #17)
> > Propose:
> > 
> > "Entire paragraph"  (to be parallel with "Entire Page" and "Entire Frame")
> 
> +1
Bug 149252