Bug 140066 - Undo of 'as character' produces wrong results (DOCX)
Summary: Undo of 'as character' produces wrong results (DOCX)
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.4.7.2 release
Hardware: All All
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:7.6.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Undo-Redo DOCX-Anchor-and-Text-Wrap
  Show dependency treegraph
 
Reported: 2021-02-01 15:32 UTC by Telesto
Modified: 2023-06-06 11:36 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (63.41 KB, application/vnd.oasis.opendocument.text)
2021-02-01 15:32 UTC, Telesto
Details
Screenshot of the original document and its docx version side by side in Writer (218.75 KB, image/png)
2021-02-09 10:41 UTC, NISZ LibreOffice Team
Details
Screenshot of the original document and its docx version after changing anchoring and undoing it in Writer (244.68 KB, image/png)
2021-02-09 10:42 UTC, NISZ LibreOffice Team
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2021-02-01 15:32:23 UTC
Description:
Undo to change of 'as character' produces wrong results

Steps to Reproduce:
1. Open the attached file
2. Save as DOCX
3. Select frame figure 1
4. Change anchor to 'as character' 
5. Undo

Actual Results:
Somewhere in the document

Expected Results:
Old position


Reproducible: Always


User Profile Reset: No



Additional Info:
Found in
7.2

and in
Version: 7.1.0.0.beta1+ (x64)
Build ID: f9fab4203c1aa0b9a3f27ce2713b6d5addc7df19
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: nl-NL
Calc: CL

and in
Version: 7.0.0.0.beta1+ (x64)
Build ID: 2891e91a513520d68ea2b8c59c14335861a15253
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL


and in
6.2

and in
Versie: 4.4.7.2 
Build ID: f3153a8b245191196a4b6b9abd1d0da16eead600
Locale: nl_NL

Looks ok with (again different layout.., but undo does work)
Versie: 4.2.0.4 
Build ID: 05dceb5d363845f2cf968344d7adab8dcfb2ba71
Comment 1 Telesto 2021-02-01 15:32:37 UTC
Created attachment 169356 [details]
Example file
Comment 2 Telesto 2021-02-01 15:33:49 UTC
Likely already reported.. but well everything looks the same.. but sometimes it slightly different after all
Comment 3 Telesto 2021-02-06 08:25:29 UTC
Still present
Version: 7.2.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 3ed9bba283a6a67864c0928186e277240be0d9ba
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL
Comment 4 NISZ LibreOffice Team 2021-02-09 10:41:22 UTC
Created attachment 169611 [details]
Screenshot of the original document and its docx version side by side in Writer

The frames horizontal and vertical positioning survives saving to docx...
Comment 5 NISZ LibreOffice Team 2021-02-09 10:42:45 UTC
Created attachment 169612 [details]
Screenshot of the original document and its docx version after changing anchoring and undoing it in Writer

...but not a change to anchor type and undoing it in:

Version: 7.2.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 44b914b1e2616ca8f70e896e653a46ca93610234
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: default; VCL: win
Locale: en-US (hu_HU); UI: en-GB
Calc: CL
Comment 6 raal 2022-04-23 07:57:24 UTC
Looks good to me, please retest
Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 8279d89d6e037def78f50c72fab2116ca56bef52
CPU threads: 4; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded Jumbo
Comment 7 Telesto 2022-04-25 09:37:46 UTC
(In reply to raal from comment #6)
Still repro

Steps to Reproduce:
1. Open the attached file
2. Save as DOCX
2. File reload (Lacking in Comment 0)
3. Select frame figure 1
4. Change anchor to 'as character' 
5. Undo

Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 4659fc2f0a7223a89446edff0b77e58758b5edf5
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: en-US (nl_NL); UI: en-US
Calc: CL
Comment 8 raal 2023-05-30 17:20:31 UTC
This seems to have begun at the below commit in bibisect repository/OS bibisect-44max.
Adding Cc: to Miklos Vajna; Could you possibly take a look at this one? Not sure if bibisect is 100% correct, because layout in 4.4 is different, but undo works.

Thanks
 61a02ce9cb6491b832cffd74c65196133ec769aa is the first bad commit
commit 61a02ce9cb6491b832cffd74c65196133ec769aa
Author: Matthew Francis <mjay.francis@gmail.com>
Date:   Sat Mar 14 22:08:24 2015 +0800

    source-hash-7596e26fd259ce5445212949403e7cd32303b2bd
    
    commit 7596e26fd259ce5445212949403e7cd32303b2bd
    Author:     Miklos Vajna <vmiklos@collabora.co.uk>
    AuthorDate: Tue Jun 24 17:11:25 2014 +0200
    Commit:     Miklos Vajna <vmiklos@collabora.co.uk>
    CommitDate: Tue Jun 24 17:47:40 2014 +0200
    
        Add SwTextBoxHelper::findShapes
    
        It builds a textbox -> shape map, so methods interested to pick the
        shape instead of a shape's textbox can call it and act accordingly if
        their textbox is in the map.
    
        Change-Id: I0f30d64a284eb461f462ed6c0a36c88271153f04
Comment 9 Commit Notification 2023-06-06 11:31:46 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5a25d9252791409f5e73616ff752a9ae8227aaf7

tdf#140066 sw: fix bad position of textbox after anchor type change + undo

It will be available in 7.6.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.