Bug 113213 - When "Continue previous numbering" is applied, it should also toggle off "restart numbering" for any item(s) that were selected for "Continue previous numbering"
Summary: When "Continue previous numbering" is applied, it should also toggle off "res...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: TableofContents-Indexes Bullet-Number-Outline-Lists
  Show dependency treegraph
 
Reported: 2017-10-18 06:47 UTC by Ulrich Windl
Modified: 2022-05-08 10:04 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments
Example document (129 bytes, text/plain)
2019-10-17 13:03 UTC, Ulrich Windl
Details
113213_restartNumbering.odt: example document to demonstrate request. (10.86 KB, application/vnd.oasis.opendocument.text)
2021-05-05 15:42 UTC, Justin L
Details
113213 _removeNumberingWhileAddingToList.patch: abandoned (2.21 KB, patch)
2021-06-26 04:05 UTC, Justin L
Details
Example file (10.32 KB, application/vnd.oasis.opendocument.text)
2022-05-04 12:51 UTC, Telesto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Windl 2017-10-18 06:47:37 UTC
Description:
I have a numbered list where the first item had a "restart numbering" option set.


Steps to Reproduce:
I moved the first item to the head of another numbered list (via cut & paste), so the old first item in the second list became the second item, but stil having number "1". So I selected "continue numbering" via right mouse button for the second item, just to find out that the number was still "1"!
Looking again I realized that "restart numbering" was still in effect. I had to deselect it, then numbering was as intended.


Actual Results:  
OK after using the fix described above.

Expected Results:
Correct result with fewer steps needed to fix.


Reproducible: Didn't try

User Profile Reset: No

Additional Info:
So these are the fixes to consider:
1) Do not copy the "restart numbering" attribute when copying list items. Or allow not pasting the attribute.
2) Make "continue numbering" and "restart numbering" mutually exclusive.
3) Both of the above.


User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Comment 1 Dieter 2017-10-18 07:28:08 UTC
I confirm the behaviour you describe, but for me this behaviour is logical. So for me it isn't a bug. And I can think of a lot of situations, where it is helpful, that the "restart numbering" remains if you copy the item.

So I change it to enhancement, because everything works as it should work. And my proposal is to close this bug as NOTABUG.
Comment 2 Mohamed 2017-10-18 08:52:30 UTC
The issue is reproduced on with:
    • Operating system : Windows 8.1 Pro 64-bits.
    • LibreOffice : Version: 5.4.2.2
		Build ID: 22b09f6418e8c2d508a9eaf86b2399209b0990f4
		CPU threads: 4; OS: Windows 6.2; UI render: default; 
		Locale: en-US (en_US); Calc: group

     And also on :
    • Operating system : Ubuntu 16.04.3 64-bits.
    • LibreOffice :Version: 5.4.2.2
		Build ID: 22b09f6418e8c2d508a9eaf86b2399209b0990f4
		CPU threads: 8; OS: Linux 4.4; UI render: default; VCL: gtk2; 
		Locale: ja-JP (ja_JP.UTF-8); Calc: group
Comment 3 Ulrich Windl 2017-10-18 11:22:09 UTC
On "NOTABUG": The original issue was ``"Resume numbering" does not cancel "restart numbering" on enumerated list''
(from comment #0)
> (...) So I selected "continue numbering" via right mouse
> button for the second item, just to find out that the number was still "1"!
> Looking again I realized that "restart numbering" was still in effect. I had
> to deselect it, then numbering was as intended.

Please read again!
Comment 4 Buovjaga 2017-11-06 16:41:56 UTC
Let's set to NEW then.
Comment 5 Thomas Lendo 2019-09-19 20:00:39 UTC
I revert the summary to it's original state because I think the bug opener was misunderstood. It's not a pasting problem. I'll test this when I'm on a PC or laptop.

Ulrich, please test again with a new document in LibreOffice 6.3 or 6.4.
Comment 6 Thomas Lendo 2019-09-22 18:36:10 UTC
I can't reproduce because if I insert parts of another list (direct formatted lists or list with styles formatting) the original list numbering isn't pasted. Therefore I can't resume nor deselect a numbering restart.

Ulrich, please retest.
Comment 7 Ulrich Windl 2019-10-17 13:03:02 UTC Comment hidden (broken, no-value)
Comment 8 Timur 2021-02-21 20:59:41 UTC Comment hidden (obsolete)
Comment 9 Justin L 2021-05-05 15:42:23 UTC
Created attachment 171653 [details]
113213_restartNumbering.odt: example document to demonstrate request.

I think I agree that a fairly logical work flow when switching from one list to another (called "add to list" instead of "continue numbering") would be to clear the "restart numbering" property at the same time.
Comment 10 Justin L 2021-05-05 19:26:58 UTC
sw/source/uibase/shells/textsh1.cxx's SwTextShell::Execute
   if ( pRule )
   {
+      if( rWrtSh.IsNumRuleStart(/*pPam=nullptr*/)
+          && rWrtSh.GetNumRuleAtCurrCursorPos() != pRule)
+      {
+          rWrtSh.SetNumRuleStart(false, /*pPam=*/rWrtSh.GetCursor());
+      }

       rWrtSh.SetCurNumRule( *pRule, false, sContinuedListId );
   }

[If the selection spans multiple numbering rules, the one at the cursor might be identical to the one being joined. So this isn't going to be consistent in every scenario, but it would cover the normal case - which should be good enough.]

But this isn't good enough because IsNumRuleStart/SetNumRuleStart only affects pPaM->GetPoint() (the end of the selection), so instead we need to somehow step through the selection and check each para if it isNumRuleStart for a different numRule.
Comment 11 Justin L 2021-06-22 12:47:27 UTC
Proposed fix at https://gerrit.libreoffice.org/c/core/+/117660.
Comment 12 Justin L 2021-06-26 04:05:52 UTC
Created attachment 173213 [details]
113213 _removeNumberingWhileAddingToList.patch: abandoned

Whether cancelling re-numbering while merging is desired will be completely dependent on the content, which a machine won't be able to determine. It would not be appreciated by automation.

If you have already shot yourself in the foot by restarting numbering a list, and now you want to shot yourself in the other foot by merging it with another list, I guess you shouldn't be surprised that you feel pain.

The patch seems fine to me, but Writer is so incredibly complex and I couldn't find the functions that I would have expected to handle basic things like walking through paragraphs. So perhaps the code is rather poor, since I felt I was re-inventing some basic things.
Comment 13 Dieter 2022-05-04 09:43:08 UTC
Since LO 7.2 we have "Add to List" instead of "Continue Previous Numbering" and we also have a documentation about it [1] and also a documentation about "Restart numbering"[2]

Ulrich, taking into account this improvments, could you please retest? (I must admit, I couldn't understand comment 9 - comment 12)
=> NEEDINFO

[1] https://help.libreoffice.org/7.3/en-GB/text/swriter/02/add_to_list.html?&DbPAR=WRITER&System=WIN

[2] https://help.libreoffice.org/7.3/en-GB/text/swriter/02/06140000.html?&DbPAR=WRITER&System=WIN(In reply to Regina Henschel from comment #12)
Comment 14 Timur 2022-05-04 11:49:49 UTC
I don't see a need for Needinfo, nor is this resolved with Help. I set New again.
Comment 15 Ulrich Windl 2022-05-04 12:29:58 UTC Comment hidden (no-value)
Comment 16 Telesto 2022-05-04 12:51:19 UTC Comment hidden (off-topic)