Bug 91811

Summary: Editing char attributes in text boxes should handle Undo better
Product: LibreOffice Reporter: Philippe Jung <phil.jung>
Component: DrawAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED WORKSFORME    
Severity: enhancement CC: heiko.tietze, Katarina.Behrens, xordevoreaux
Priority: medium    
Version: 5.0.0.0.alpha0+ Master   
Hardware: Other   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=88276
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 100371    

Description Philippe Jung 2015-06-02 13:31:54 UTC
In fix implemented for bug 88276, if you create a text box with "A"
Then you edit it, type "B C"
Select B, make background light purple
Select C, make background dark watermelon (the colors have no importance)
Click outside the text box
Type Ctrl-Z

I would expect a step by step Undo

Currently, text box becomes "A" with no bg color.
Comment 1 Katarina Behrens (Inactive) 2015-06-04 08:56:58 UTC
It's not limited to text background colour (thus, adjusting the summary). 

Repeat the experiment from initial comment with font colour, click outside the box, Ctrl-Z for undo and ta-da - the whole content of text box disappears.

Interestingly enough, undo more-less works when undoing while the cursor is still inside the text box.

Anyway, confirming
Comment 2 xordevoreaux 2020-08-22 20:12:50 UTC
Behavior has changed slightly since origination of this bug.

Using:

Version: 7.1.0.0.alpha0+ (x64)
Build ID: 8700bace8c0714d853f5df6918ab9c8bb3d81f77
CPU threads: 8; OS: Windows 10.0 Build 20197; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL

If you follow the original steps:

=====================
If you create a text box with "A"
Then you edit it, type "B C"
Select B, make background light purple
Select C, make background dark watermelon (the colors have no importance)
Click outside the text box
Type Ctrl-Z

I would expect a step by step Undo

Currently, text box becomes "A" with no bg color.
=====================

Undo does track the change to each character within the text box during any single session of editing the text box's contents before clicking outside of it.

However, if the user completes all the above edits and THEN clicks outside of the text box and hits Control-Z (or Edit, Undo), the text box disappears entirely (because Undo: Insert was the last edit tracked) or reverts to whatever was last typed in the text box prior to the last set of edits.

Therefore, there IS a step-by-step undo, but it's at the current object's level. While within the text box object, edits track changes within the object as one would expect (reversing the colorization one Undo at a time of A, B, and C).

Clicking outside of the text box tracks changes at the level above that, meaning the entire container (Insert: Text Box) versus its contents.

So this works for me, based on my understanding of how Undo works.




Step-by-step undo DOES WORK if you click outside of the text box per editing instance (change "A", click outside, change "B", click outside, etc).