Bug 132321 - Deleting a paragraph at start or end of section deletes the object anchored to it
Summary: Deleting a paragraph at start or end of section deletes the object anchored t...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.4.0.0.beta1+
Hardware: All All
: medium normal
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: target:7.1.0 target:7.0.0.1 target:6....
Keywords: bibisected, bisected, regression
: 132817 (view as bug list)
Depends on:
Blocks: Anchor-and-Text-Wrap Writer-Images
  Show dependency treegraph
 
Reported: 2020-04-22 09:27 UTC by Telesto
Modified: 2020-06-29 13:45 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (8.67 KB, application/vnd.oasis.opendocument.text)
2020-04-22 09:32 UTC, Telesto
Details
Example file (674.33 KB, application/vnd.oasis.opendocument.text)
2020-06-13 08:18 UTC, Telesto
Details
Example file (459.36 KB, application/vnd.oasis.opendocument.text)
2020-06-14 14:46 UTC, Telesto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2020-04-22 09:27:57 UTC
Description:
Deleting a paragraph deletes the object anchored to it while the anchor is invisible

Steps to Reproduce:
1. Open the attached file
2. Go the last paragraph & press backspace.. button disappears

Actual Results:
But disappears because paragraph is deleted

Expected Results:
Maybe jump the anchor to the next paragraph?


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.0.0.0.alpha0+ (x64)Build ID: 8c8b3a4f83f67882b284ddc3b3fe10d3fe6dedf4CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win; Locale: nl-NL (nl_NL); UI-Language: en-USCalc: CL
Comment 1 Telesto 2020-04-22 09:32:02 UTC
Created attachment 159808 [details]
Example file

No repro with
LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4
Comment 2 Dieter 2020-04-28 08:53:00 UTC
I confirm mit with

Version: 7.0.0.0.alpha0+ (x64)Build ID: 8c8b3a4f83f67882b284ddc3b3fe10d3fe6dedf4CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win; Locale: de-DE (de_DE); UI-Language: en-GBCalc: CL

but not with

Version: 6.3.5.2 (x64)
Build-ID: dd0751754f11728f69b42ee2af66670068624673
CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; VCL: win; 
Gebietsschema: de-DE (de_DE); UI-Sprache: de-DE
Calc: threaded


Same behaviour with images and it only happens, if anchor is in last paragraph.
Comment 3 Attila Baraksó (NISZ) 2020-04-28 12:12:53 UTC
Bibisected using bibisect-win64-6.4 to:
URL: https://cgit.freedesktop.org/libreoffice/core/commit/?id=e75dd1fc992f168f24d66595265a978071cdd277
author: Michael Stahl <Michael.Stahl@cib.de>
committer: Michael Stahl <Michael.Stahl@cib.de>
summary: tdf#121300 sw: consistent fly at-pargraph selection

Adding Cc: Michael Stahl
Comment 4 Commit Notification 2020-06-11 17:11:16 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/be2f539012d818eaa2d40a9cf199b53d32e1dee4

tdf#132321 sw: adapt fly at-para deletion to at-char wrt. sections

It will be available in 7.1.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 5 Michael Stahl (allotropia) 2020-06-11 17:15:05 UTC
fixed on master
Comment 6 Commit Notification 2020-06-12 09:40:06 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/f5509026e7fbb354b2acc8ad62100d71e59cc0be

tdf#132321 sw: adapt fly at-para deletion to at-char wrt. sections

It will be available in 7.0.0.1.

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 7 Xisco Faulí 2020-06-12 10:20:09 UTC
Hi Michael,
I'm afraid the issue is still reproducible in

Version: 7.1.0.0.alpha0+
Build ID: ff508f6d8a3e58d29e9e7622006a7103fb0a2849
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

Steps to reproduce:
1. Open the attached file
2. Select all
3. Delete

-> The button is deleted

However, this behaviour is not seen before https://cgit.freedesktop.org/libreoffice/core/commit/?id=e75dd1fc992f168f24d66595265a978071cdd277
Comment 8 Michael Stahl (allotropia) 2020-06-12 11:23:58 UTC
(In reply to Xisco Faulí from comment #7)
> 
> Steps to reproduce:
> 1. Open the attached file
> 2. Select all
> 3. Delete
> 
> -> The button is deleted

this is intentional - select all should delete *everything*.
Comment 9 Xisco Faulí 2020-06-12 11:26:46 UTC
(In reply to Michael Stahl (CIB) from comment #8)
> (In reply to Xisco Faulí from comment #7)
> > 
> > Steps to reproduce:
> > 1. Open the attached file
> > 2. Select all
> > 3. Delete
> > 
> > -> The button is deleted
> 
> this is intentional - select all should delete *everything*.

Ok, I mentioned 'select all' to keep it simple, but it's also reproducible if you go to the last paragraph and use backspace to remove all the paragraphs
Comment 10 Michael Stahl (allotropia) 2020-06-12 11:58:53 UTC
(In reply to Xisco Faulí from comment #9)
> Ok, I mentioned 'select all' to keep it simple, but it's also reproducible
> if you go to the last paragraph and use backspace to remove all the
> paragraphs

in this case, with 2 empty paragraphs the selection will be indistinguishable from one created by "select all".
Comment 11 Commit Notification 2020-06-12 13:21:11 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/f63a28dc13e234e7509fdb8986e45db14a2d32ec

tdf#132321 sw: adapt fly at-para deletion to at-char wrt. sections

It will be available in 6.4.6.

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 12 Xisco Faulí 2020-06-12 15:50:06 UTC
(In reply to Michael Stahl (CIB) from comment #10)
> (In reply to Xisco Faulí from comment #9)
> > Ok, I mentioned 'select all' to keep it simple, but it's also reproducible
> > if you go to the last paragraph and use backspace to remove all the
> > paragraphs
> 
> in this case, with 2 empty paragraphs the selection will be
> indistinguishable from one created by "select all".

but I don't get it, I've tried with different versions, 4.1, 4.4, 5.3, 6.0 and 6.4 alpha1 and the button never gets deleted, either but selecting all and deleting or by deleting each paragraph individually.
Has this behaviour always been incorrect ?
Comment 13 Michael Stahl (allotropia) 2020-06-12 16:00:22 UTC
(In reply to Xisco Faulí from comment #12)
> but I don't get it, I've tried with different versions, 4.1, 4.4, 5.3, 6.0
> and 6.4 alpha1 and the button never gets deleted, either but selecting all
> and deleting or by deleting each paragraph individually.
> Has this behaviour always been incorrect ?

imho yes, in case of select all.  i find it quite annoying if you select-all and copy and then something in the document isn't copied.
Comment 14 Telesto 2020-06-13 08:18:35 UTC
Created attachment 161943 [details]
Example file

> imho yes, in case of select all.  i find it quite annoying if you select-all
> and copy and then something in the document isn't copied.

-> I agree.. however, found another example where this not happening

1. Open the attached file
2. CTRL+A
3. CTRL+X

-> Or should I create a new bug report?
Comment 15 Telesto 2020-06-14 14:26:23 UTC
(In reply to Michael Stahl (CIB) from comment #13)
> (In reply to Xisco Faulí from comment #12)
> > but I don't get it, I've tried with different versions, 4.1, 4.4, 5.3, 6.0
> > and 6.4 alpha1 and the button never gets deleted, either but selecting all
> > and deleting or by deleting each paragraph individually.
> > Has this behaviour always been incorrect ?
> 
> imho yes, in case of select all.  i find it quite annoying if you select-all
> and copy and then something in the document isn't copied.

I would love some description how anchoring & selecting and deleting images supposed to work. There are quite a list of similar - but of course somehow - different cases..
Comment 16 Telesto 2020-06-14 14:46:59 UTC
Created attachment 161988 [details]
Example file

Another 'hard' (corner) case.. Press CTRL+A CTRL+X doesn't select the image. You can't delete the image anchor with backspace either. Type letter. Press backspace - Image gone & CTRL+A is working.

So if we do want to change the behaviour.. please do it consistently.. ideally with all anchors (except to page/ to frame) doing the same thing.. And also for 'all objects; shapes/images/frames'; I have the impression - please let me be wrong - that there are multiple (2 maybe 3?) 'anchoring to character/paragraph' logics around. So the one used is depending on object; to character anchoring of an image is different from 'to character'  anchoring for shapes).. not sure how much the diverge.. but there appears to be a different. 

Harmonizing the behaviour would also limit he number of possibility's of an undo crash; I guess..
Comment 17 Telesto 2020-06-14 16:43:29 UTC
A this is lovely: bug 133957 comment 3 and bug 131331 

Still tending to M. Stahl is vision, but i'm sensing complains.. about what is desired..
Comment 18 Xisco Faulí 2020-06-15 08:30:37 UTC
(In reply to Telesto from comment #14)
> Created attachment 161943 [details]
> Example file
> 
> > imho yes, in case of select all.  i find it quite annoying if you select-all
> > and copy and then something in the document isn't copied.
> 
> -> I agree.. however, found another example where this not happening
> 
> 1. Open the attached file
> 2. CTRL+A
> 3. CTRL+X
> 
> -> Or should I create a new bug report?

Please do. Let's close this one as RESOLVED FIXED
Comment 19 Michael Stahl (allotropia) 2020-06-15 10:04:52 UTC
(In reply to Telesto from comment #16)
> Created attachment 161988 [details]
> Example file
> 
> Another 'hard' (corner) case.. Press CTRL+A CTRL+X doesn't select the image.
> You can't delete the image anchor with backspace either. Type letter. Press
> backspace - Image gone & CTRL+A is working.

okay this is same as https://bugs.documentfoundation.org/show_bug.cgi?id=133957#c3 - will reply there...

> So if we do want to change the behaviour.. please do it consistently..
> ideally with all anchors (except to page/ to frame) doing the same thing..

that is the goal, i've adapted at-char and at-para; at-frame could need some changes but i haven't got a budget for that so i haven't looked at it in detail.

at-page is generally crazy anyway.

> And also for 'all objects; shapes/images/frames'; I have the impression -
> please let me be wrong - that there are multiple (2 maybe 3?) 'anchoring to
> character/paragraph' logics around. So the one used is depending on object;
> to character anchoring of an image is different from 'to character' 
> anchoring for shapes).. not sure how much the diverge.. but there appears to
> be a different. 

really? i hope they work the same.
Comment 20 Michael Stahl (allotropia) 2020-06-15 10:16:36 UTC
(In reply to Telesto from comment #15)
> I would love some description how anchoring & selecting and deleting images
> supposed to work. There are quite a list of similar - but of course somehow
> - different cases..

the current idea for the general case in the UI is:

for at-char the character position is compared.
for at-para only the paragraph is compared.

1. if the fly anchor is behind the start of the selection and before the end of the selection, it is selected.
2. if the fly anchor is equal to the start or end of the selection, and the entire section is selected (from start of its first paragraph to end of its last one), then it is selected
3. if the fly anchor is equal to the start or end of the selection, and the selection "looks like" backspace or delete key, it is *not* selected
4a. if the fly anchor is equal to the start of the selection, and the selection spans more than 1 paragraph, and the selection starts at the start of a paragraph, the fly is selected
4b. if the fly anchor is equal to the end of the selection, and the selection spans more than 1 paragraph, and the selection ends at the end of a paragraph, the fly is selected
Comment 21 Commit Notification 2020-06-15 13:22:18 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/362c883985dbdd17e138d20c97c650ea3246f882

tdf#132321: sw: Add unittest

It will be available in 7.1.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 22 Commit Notification 2020-06-15 13:56:01 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b314735568c1e9ab8ca52413017425bc2ef12973

tdf#132321 tdf#133957 sw: for at-para fly, ignore anchor SwIndex

It will be available in 7.1.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 23 Xisco Faulí 2020-06-15 15:29:41 UTC
*** Bug 132817 has been marked as a duplicate of this bug. ***
Comment 24 Commit Notification 2020-06-16 10:12:11 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/eb6290410e699841b805ef75df393d72bf50baaa

tdf#132321 tdf#133957 sw: for at-para fly, ignore anchor SwIndex

It will be available in 7.0.0.1.

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 25 Commit Notification 2020-06-17 08:54:25 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/81580e8850a1f256262edeaea990fb40c0dd637f

tdf#132321 tdf#133957 sw: for at-para fly, ignore anchor SwIndex

It will be available in 6.4.6.

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 26 Commit Notification 2020-06-24 14:21:26 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-6-4-5":

https://git.libreoffice.org/core/commit/86a3470455c92353e731979c1743657731a23e10

tdf#132321 sw: adapt fly at-para deletion to at-char wrt. sections

It will be available in 6.4.5.

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.