Bug 149044 - Autonumbering and the action which caused it are combined into a single undo step
Summary: Autonumbering and the action which caused it are combined into a single undo ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.3.3.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Bullet-Number-Outline-Lists Undo-Redo
  Show dependency treegraph
 
Reported: 2022-05-12 06:45 UTC by lvm
Modified: 2023-07-26 19:58 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description lvm 2022-05-12 06:45:32 UTC
Description:
autonumbering and the action which caused it are combined into a single undo step

Steps to Reproduce:
prerequisites: autonumbering is enabled. 

1. type the quoted text without pressing enter that automubering won't be applied "1. item1 item2"

2. position cursor between item1 and item2 and press enter - line is split in two, both are numbered

3. press ^Z

Actual Results:
both line split and autonumbering are undone in a single step - impossible to split the line without numbering it.

Expected Results:
Autonumbering and line split should be undone in two steps like for e.g. automatic URL recognition - when you type a space after the unclickable text URL and then press ^Z, only the URL recognition is undone, to undo the space you have to press ^Z once more - correct behaviour here.


Reproducible: Always


User Profile Reset: No


OpenGL enabled: Yes

Additional Info:
Version: 7.3.3.2 / LibreOffice Community
Build ID: d1d0ea68f081ee2800a922cac8f79445e4603348
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: kf5 (cairo+xcb)
Locale: en-GB (en_GB.UTF-8); UI: en-GB
Calc: threaded
Comment 1 Dieter 2022-05-24 16:23:44 UTC
I confirm the observed behaviour with

Version: 7.3.4.1 (x64) / LibreOffice Community
Build ID: 13668373362b52f6e3ebcaaecb031bd59a3ac66b
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

but for me it's the expected behaviour, because you've enabled autonumbering. But it's still possible to ad a line brakt with Ctrl+Enter

=> NAB

Feel free to change i back to UNCONFIRMED with a short reasoning, if you disagree.
Comment 2 lvm 2022-05-24 18:53:00 UTC
I believe I already explained why it is a bug - it is inconsistent with undo behaviour for other types of autoformatting in LO e.g. URL recognition. This and only this is the correct undo behaviour because it allows one to undo autoformatting if it was not needed without undoing the action which caused it.
Comment 3 Dieter 2022-05-24 19:03:45 UTC
(In reply to lvm from comment #2)
> I believe I already explained why it is a bug - it is inconsistent with undo
> behaviour for other types of autoformatting in LO e.g. URL recognition.

I don't understand. If I type www.example.com and press enter, a new paragraph is inserted and text is recognized as link. Undo deletes paragraph and URL recognition.

Perhaps another user understands your argument in a better way.
Comment 4 lvm 2022-05-25 06:58:30 UTC
Actually, we are both correct and the problem is deeper: if after an URL-like text is typed or pasted space bar is pressed, undo undoes only URL autoformatting, to undo the space one has to press ^Z once more. If however one presses enter, undo not only undoes both autoformatting and a new line in a single step, but also for some reason selects the URL text - why? There is no selection after autonumbering is undone. And there is another issue: URL autoformatting is triggered after the first non-URL character is typed, auto numbering however only after a new paragraph - inconsistency again, autonumbering should've been applied as soon as the trigger text "1. " is typed at the beginning of the line. In short, autoformatting and its undo is an inconsistent spaghetti and a good candidate for refactoring, if you ask me.

Back to the original point: I am of a very firm opinion that autoformatting and the action which triggered it may not be combined into a single undo step because autoformatting is often wrong and there should be an easy way to undo only autoformatting but not the action which triggered it.
Comment 5 Heiko Tietze 2023-01-12 09:53:47 UTC
With "autonumbering" do you mean ordered (aka numbered) list?
Comment 6 lvm 2023-01-12 10:04:45 UTC
(In reply to Heiko Tietze from comment #5)
> With "autonumbering" do you mean ordered (aka numbered) list?

Yes, but it is the same for bulleted lists. And when undoing 7.4.3.2 now selects the trigger expression ("1. " or "* "). If something is already selected you get two selections!
Comment 7 Heiko Tietze 2023-01-12 10:58:35 UTC
(In reply to lvm from comment #6)
> (In reply to Heiko Tietze from comment #5)
> > With "autonumbering" do you mean ordered (aka numbered) list?
> 
> Yes, but it is the same for bulleted lists. And when undoing 7.4.3.2 now
> selects the trigger expression ("1. " or "* "). If something is already
> selected you get two selections!

The list style (LS) is an attribute of the paragraph style (PS). PS do have another attribute which defines what PS follows (eg. Text Body after Heading). If you have a PS with LS that is follows at itself, the usual situation for ordinary text, it will continue the numbering. There are no two functions.

To "remove" the number you may just toggle the ordered/unordered list off (aka numbers/bullets) or apply a different PS, depending on how you applied the LS.

See also bug 152624.
Comment 8 lvm 2023-01-12 13:07:20 UTC
bug 152624 is completely related at all, nor the styles. This bug is about undo's inability to restore the document to the desired state. When a keystroke modifies the document and triggers autoformatting, the first undo step must undo autoformatting only and leave the document in the state after the keystroke modified the document but before autoformatting was applied in case it was applied erroneously, and undo the keystroke itself in a second separate step.
Comment 9 Heiko Tietze 2023-01-12 14:26:11 UTC
(In reply to lvm from comment #8)
> When a keystroke modifies the document and triggers autoformatting...

That's not true, you enter a paragraph break and the new paragraph is layout as defined in the style. => NAB
Comment 10 lvm 2023-01-12 18:41:06 UTC
(In reply to Heiko Tietze from comment #9)
> (In reply to lvm from comment #8)
> > When a keystroke modifies the document and triggers autoformatting...
> 
> That's not true, you enter a paragraph break and the new paragraph is layout
> as defined in the style. => NAB

Ok, when enter is pressed two things happen:
1. paragraph is split into two
2. style of both is modified to include a list

Undo should undo step 2, then step 1, not both together in a single step. If you are implying that under the hood it actually happens the other way around: style changed first, then paragraph is split, that's too bad - underlying technical design is not a consideration in UX. From user's POV enter is pressed to split a paragraph and then list style is applied, and that's how it should be undone.

Also this bug was already confirmed (comment 1) so it is NEW, not UNCONFIRMED.