Bug 129270 - Chapter Numbering of Heading 1 changes after setting Return, if Next Style is set to Heading 2
Summary: Chapter Numbering of Heading 1 changes after setting Return, if Next Style is...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.1.0.3 release
Hardware: All All
: medium normal
Assignee: Vasily Melenchuk (CIB)
URL:
Whiteboard: target:7.3.0 target:7.2.1
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Heading-Numbering
  Show dependency treegraph
 
Reported: 2019-12-07 18:59 UTC by Robert Großkopf
Modified: 2021-08-24 18:51 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Open the document and set a return after last Hedaing. Numbering changes to wrong number. (9.08 KB, application/vnd.oasis.opendocument.text)
2019-12-07 18:59 UTC, Robert Großkopf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Großkopf 2019-12-07 18:59:46 UTC
Created attachment 156401 [details]
Open the document and set a return after last Hedaing. Numbering changes to wrong number.

Open the attached Writer document. 
Last line is "2 This is the second Heading 1". 
Set the cursor at the end of this line an press Enter. 
The numbering will be changed to 1.2, which is the second step of the numbering of "Heading 2".

This buggy behavior appears in LO 6.4.0.0beta1, also in LO 6.1.0.3. It doesn't appear in LO 6.0.5.2 on OpenSUSE 15.1 64bit rpm Linux.
Comment 1 Oliver Brinzing 2019-12-08 07:38:28 UTC
reproducible with:

Version: 6.1.6.3 (x64)
Build-ID: 5896ab1714085361c45cf540f76f60673dd96a72
CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; 
Gebietsschema: de-DE (de_DE); Calc: group threaded

but *not* reproducible with:

Version: 6.0.7.3 (x64)
Build-ID: dc89aa7a9eabfd848af146d5086077aeed2ae4a5
CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; 
Gebietsschema: de-DE (de_DE); Calc: 

btw: after a save & reload cycle the chapter numbering is corrected. 

maybe related to:
Bug 128891 - FILEOPEN: Level 2 chapter enumeration doesn't reset counter

i will try to bisect
Comment 2 Oliver Brinzing 2019-12-08 08:07:09 UTC
seems to have started with:

https://gerrit.libreoffice.org/plugins/gitiles/core/+/03a4d74e3d7f10313b034cc8325dc9a87aa6721d

commit 03a4d74e3d7f10313b034cc8325dc9a87aa6721d	[log]
author	Serge Krot <Serge.Krot@cib.de>	
Mon Jun 18 18:15:55 2018 +0200
committer	Thorsten Behrens <Thorsten.Behrens@CIB.de>
Mon Jun 25 16:11:44 2018 +0200
tree c0280fac5c7d985adf8776dbb8778240d233ae5d
parent 56a68f70ec8ddf8a452732e51828f877ed49999c [diff]

tdf#113877 Insert doc: merge list into text with specifc style

When inserting document, in the current position the text could have custom
style but really it is the same Standard style. Therefore we should not
merge first inserted node into the insert position and just overwrite
style in the insert position with text style from the inserted node.

Change-Id: Ib67c56bed3d30f356f83dc0b4d4a1710def10853
Reviewed-on: https://gerrit.libreoffice.org/56052
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
(cherry picked from commit baf3cec77db5f03200c038101e77720fae2ffba3)
Reviewed-on: https://gerrit.libreoffice.org/56366

    sw/qa/extras/uiwriter/data/tdf113877_blank.odt[Added - diff]
    sw/qa/extras/uiwriter/data/tdf113877_blank_ownStandard.odt[Added - diff]
    sw/qa/extras/uiwriter/uiwriter.cxx[diff]
    sw/source/core/txtnode/ndtxt.cxx[diff]

4 files changed

 /cygdrive/d/sources/bibisect/bibisect-win32-6.1
$ git bisect good a490b913ed4d763b78747330cebda1c1c3fea45b is the first bad commit
commit a490b913ed4d763b78747330cebda1c1c3fea45b
Author: Norbert Thiebaud <nthiebaud@gmail.com>
Date:   Mon Jun 25 15:49:10 2018 -0700

    source 03a4d74e3d7f10313b034cc8325dc9a87aa6721d

    source 03a4d74e3d7f10313b034cc8325dc9a87aa6721d

:040000 040000 ece2d28da0d1c0367287f0145529be7fe61d362b 819d385d15672090facc8dd8235e03fd98a985f6 M      instdir

/cygdrive/d/sources/bibisect/bibisect-win32-6.1
$ git bisect log
# bad: [75d131082ce51ed5a898d97bdc2b7a9fe5ddb340] source 5b3765f4d881e7ddefd0c4aad6886a46f000b4fc
# good: [29d08f54c2f71ffee4fe12dbb24c5f5cbedecfd2] source 6eeac3539ea4cac32d126c5e24141f262eb5a4d9
git bisect start 'master' 'oldest'
# good: [6227e15df9be101688e37cd891817cd858b49e03] source b8b7f8a8f8d97088181d287bb75e74facece16c6
git bisect good 6227e15df9be101688e37cd891817cd858b49e03
# good: [50b236fe0d359b9d5cc9998d2e72009a90a11d08] source b6025e6cffe2024fefebd161ea739188b4b4fdaf
git bisect good 50b236fe0d359b9d5cc9998d2e72009a90a11d08
# good: [d59609a1bfbbb4f924492755719b7d340a51de1b] source eeaf4b0b7ad21da879554bdd93c9a9b97b8268d6
git bisect good d59609a1bfbbb4f924492755719b7d340a51de1b
# bad: [75029ade8fd0bbe5abc530394b85b346b499bc55] source ec79d0127f90d65d722e46688b6cfcf2f5e59794
git bisect bad 75029ade8fd0bbe5abc530394b85b346b499bc55
# bad: [615238624584cc719cd84469c8fa9f44f4fb717f] source 945cca96e110262d2e33554716692f230215b189
git bisect bad 615238624584cc719cd84469c8fa9f44f4fb717f
# good: [34221d19029a1230e4780a627fac02045363ef5a] source 6ceaf86d3548375d19c28fa7783c42a4da4637fb
git bisect good 34221d19029a1230e4780a627fac02045363ef5a
# good: [f65617863e1676a8e2b39e50cf99aac5facf5246] source b86a8857e6488bac1224a9eed471bcf930994399
git bisect good f65617863e1676a8e2b39e50cf99aac5facf5246
# bad: [9251c87c98bd26200b43a3002096e888c70462df] source 8f56cf1f5b29326371b9c29e2b9ccd81ed760941
git bisect bad 9251c87c98bd26200b43a3002096e888c70462df
# good: [eb466972d5e675eab75c028bb7e2eff2ef797af3] source 546a4b61390ab1eee44dbf982a582b1de3a9a5a9
git bisect good eb466972d5e675eab75c028bb7e2eff2ef797af3
# good: [04f54515201ecd488785d8aed9cadd8216eb9e7a] source 9ac5100cd3c9d7767067a3421c736b99b76670ed
git bisect good 04f54515201ecd488785d8aed9cadd8216eb9e7a
# good: [5f6108c7c253196ccfc9e23e36736b6d4218590f] source 0b77d890bcbc189ff12cf5dab683c6aed881c177
git bisect good 5f6108c7c253196ccfc9e23e36736b6d4218590f
# bad: [a490b913ed4d763b78747330cebda1c1c3fea45b] source 03a4d74e3d7f10313b034cc8325dc9a87aa6721d
git bisect bad a490b913ed4d763b78747330cebda1c1c3fea45b
# good: [011be7a96a380f495af59cf4237818c414b76c99] source 56a68f70ec8ddf8a452732e51828f877ed49999c
git bisect good 011be7a96a380f495af59cf4237818c414b76c99
# first bad commit: [a490b913ed4d763b78747330cebda1c1c3fea45b] source 03a4d74e3d7f10313b034cc8325dc9a87aa6721d


also reproducible with:

Version: 6.5.0.0.alpha0+ (x64)
Build ID: 00262b08984fb2fb91b760d588851bd47ae4d3ac
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: default; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-US
Calc: threaded
Comment 3 Justin L 2021-03-23 15:10:38 UTC
repro 7.2+
Comment 4 BogdanB 2021-07-27 05:10:37 UTC
Retested. Also in
Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: 612d5b1a04fe022a34018d901bb9b052791d54e5
CPU threads: 4; OS: Linux 5.8; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 5 Justin L 2021-07-28 09:36:46 UTC
[I'm having a hard time recreating this problem from scratch. It doesn't happen with ANY style-with-next-style. It doesn't even necessarily apply to Chapter numbering enabled. It seems to only happen when the Chapter Numbering style is directly (re)applied to the paragraph.]

Prior to 
-    if( nInitSize || pDest->HasSwAttrSet() ||
pDest->HasAttrSet is true, so everything was set.

But now that
+    if( nInitSize || hasSwAttrSet ||
is false it copies everything, including the ListLevel.

This could be a bit tricky because this is function CutImpl/CutText, which is used in more places than just from this document's context of SplitContentNode()

Here is debugging output when hitting Enter:
::CutImpl copy hard attributes on whole paragraph. Dest[This is the first Heading 1] Len[27]
 ---nWHich[83]  #LIST_LEVEL
 ---nWHich[127] #FRAME_STYLE_NAME
 ---nWHich[128] #CONDITIONAL_STYLE_NAME
nInitSize[0] hasSwAttrSet[0]

The code for cut and split are FILLED with special handling for numbering. Perhaps:
-           hasSwAttrSet =  false;
-           if (pDest->GetpSwAttrSet())

+           hasSwAttrSet = pDest->GetAttrListLevel() != GetAttrListLevel();
+           if (!hasSwAttrSet && pDest->GetpSwAttrSet())
Comment 6 Commit Notification 2021-08-12 12:11:47 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "master":

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

tdf#129270: sw: do not copy list level on paragraph cut

It will be available in 7.3.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 7 Commit Notification 2021-08-13 08:29:05 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/41c30076dded61163d3c765eb897bf6a62f75120

tdf#129270: sw: do not copy list level on paragraph cut

It will be available in 7.2.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 8 BogdanB 2021-08-24 18:51:26 UTC
Thanks for your work. Working well.

Verified. Fixed in
Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: fbe183bbb05220a4ccc51952445b1797bb498403
CPU threads: 4; OS: Linux 5.11; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded