Bug 132091 - DOCX formtext content is lost after filling
Summary: DOCX formtext content is lost after filling
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.4.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: target:7.0.0 target:6.4.4
Keywords: bibisected, regression
Depends on:
Blocks:
 
Reported: 2020-04-14 07:02 UTC by Vasily Melenchuk (CIB)
Modified: 2020-06-03 16:37 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Test File (5.94 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-04-14 07:02 UTC, Vasily Melenchuk (CIB)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vasily Melenchuk (CIB) 2020-04-14 07:02:14 UTC
Description:
A document containing filling form (FORMTEXT) in some cases can lose content after filling.

Steps to Reproduce:
1. Open attached document (test.docx)
2. Double click form value (text "ASDF") to select it all. Important step, if previous content is removed in a different way bug can not appear.
3. Enter new text value. Previous will be removed/owerwritten.
4. Save and reopen document.

Actual Results:
FORMTEXT value is not displayed.

Expected Results:
User should see same text he enters on step 3.


Reproducible: Always


User Profile Reset: No



Additional Info:
As far as I found during look into document structure, result is actually written into resulting DOCX, but for unknown to me reasons it is written *before* field separator.

So instead 
- fldChar begin
- FORMTEXT
- fldChar separate
- ASDF
- fldChar end

we have in this scenario:
- fldChar begin
- FORMTEXT
- ASDF
- fldChar separate
- fldChar end
Comment 1 Vasily Melenchuk (CIB) 2020-04-14 07:02:54 UTC
Created attachment 159548 [details]
Test File
Comment 2 Vasily Melenchuk (CIB) 2020-04-14 07:06:28 UTC
This issue is bbsectable, found bad commit in 6.4 bbsect repo:

commit 20a1d947987076c93561700c5cfb8a12f190dea9 (refs/bisect/bad)
Author: Norbert Thiebaud <nthiebaud@gmail.com>
Date:   Wed Oct 23 04:58:04 2019 -0700

    source d9030ad6298e2f49ee63489d6158ea6ad23c0111

    source d9030ad6298e2f49ee63489d6158ea6ad23c0111
    source 2e636ee01e32208387ca77c4edadf6929063158a
    source ddd08c8996d444d7c0fe49d083c4f70f0a278d14
    source 94e0b8407b02d76b27324b8b08012eb024aca9e9
    source 4f174e66431628fa1343ec44d63cc3f02cc0bb0b
    source dd179e9c8f6f98268e204c0672be31bf008475cd
    source 4212803e08052af2c1b3618f52fefb651c429345
    source 6eb1c2304d257d16858b7b51cad63f1dc2bde88b
    source 26599f049df7c52eca001ba52a0684888201e1ba
    source 35b93ab6be79e5506248aea2f5b618db54e93c0f
    source e47615f1c1b17f66e5b30275e666bc7a7bf43d1c
    source 80e9e3747ba622300c7ef66018b5fa6945add0f6
    source ae97beb73efca8e31a7b2d93d55bdb118711d72a
    source e0e0109f01929024f7dd60a97616bb3b25de3b92
    source a0fa6911a013dc5cc844fdbee13132a467f4a437
    source 19a559b0ec9b806519c405651d6d2b2e14712b4a
    source d426964c0d3e42058f93f764eab1257cf9d21d4c
    source 6851182cb61a70d3ebd6ee098e8ba5f23582b352
    source f610f9b611fe9f206b872ed06f7e859d688385fc
    source 12385f9e79e15b215c1d398b4bfb212ef1b23fb3
    source bc5e4104e281b89c08df102851e5693f35772c40
    source 7f2e61f884949ab27bcb7e1a02ece9a5cb4354b9
    source 1332cf210803215857b81e8ca9c029aa3d6c49c2
    source ffb26b81e1c7ff1d64959200247bb2edd5a569da
    source 4dc1615c80e8e66d339dc86fa95bbc76e884d988

All these commits by Michael Stahl, adding him to CC.
Comment 3 Michael Stahl (allotropia) 2020-04-15 17:59:43 UTC
fixed on master
Comment 4 Commit Notification 2020-04-15 18:00:22 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1c94842e053a20a739a181d38a35c324df3e62a7

tdf#132091 sw: fix fieldmark mess in SwCursor::SelectWordWT()

It will be available in 7.0.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 Commit Notification 2020-04-16 10:41:12 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

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

tdf#132091 sw: fix fieldmark mess in SwCursor::SelectWordWT()

It will be available in 6.4.4.

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 6 BogdanB 2020-05-10 12:54:00 UTC
Great!
Works well on
Version: 7.0.0.0.alpha1
Build ID: 6a03b2a54143a9bc0c6d4c7f1...
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3; 
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded