Bug 92137 - Diagram/undo: Box resize undoes wrongly
Summary: Diagram/undo: Box resize undoes wrongly
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium minor
Assignee: Not Assigned
Whiteboard: target:5.1.0
Depends on:
Blocks: Matters-to-Caolan
  Show dependency treegraph
Reported: 2015-06-17 13:05 UTC by Dr. David Alan Gilbert
Modified: 2016-10-25 19:24 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:

Diagram that undoes wrongly after resizing box (9.95 KB, application/vnd.oasis.opendocument.text)
2015-06-17 13:05 UTC, Dr. David Alan Gilbert

Note You need to log in before you can comment on or make changes to this bug.
Description Dr. David Alan Gilbert 2015-06-17 13:05:41 UTC
Created attachment 116604 [details]
Diagram that undoes wrongly after resizing box

See attached document. (On Fedora 22 x86-64
1) Click the left edge of the outer blue box
2) With that selected, drag the edge to the right, e.g. to line up with the left edge of the smaller box.  The outer box is now narrower than before, but it's vertical position is unchanged.
3) hit ctrl-z to undo

Observed behaviour:
   When hitting ctrl-z the box returns to a point higher up than it originally was.
Comment 1 Buovjaga 2015-06-19 17:05:54 UTC

Win 7 Pro 64-bit Version:
Build ID: 437210d58f32177ef1829d704f7f4d2f1bbfbfdd
TinderBox: Win-x86@39, Branch:master, Time: 2015-06-18_07:21:56
Locale: fi-FI (fi_FI)

Ubuntu 15.04 64-bit 
OpenOffice.org 3.3.0
OOO330m20 (Build:9567)
Comment 2 Caolán McNamara 2015-07-01 20:10:48 UTC
hmm, if I click on these there is no "anchor" drawn. So I think the undo "works" to restore the position of the object relative to the anchor, but its the selection of "anchor" that has gone awry. e.g. if I change the anchor before I move it then the undo restores it correctly.
Comment 3 Caolán McNamara 2015-07-03 11:08:33 UTC
If SwFEShell::EndDrag is tweaked to not group the anchor change undo and the draw size/pos change undo together and then you undo each step in the ui one at a time this works fine.
So what's apparently happening is that the first undo occurs, then the layout kicks in on idle and calls MakeObjPos on the drawing item and updates it for the new anchor pos. Then on triggering size undo the anchor is correct so the new pos is set correctly.
If they are bundled together however, the layout at idle doesn't occur until after the anchor and size have been set, so the adjustment is too late
Comment 4 Commit Notification 2015-07-03 12:33:41 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":


Resolves: tdf#92137 drawing layer resize undo in writer fails...

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
Affected users are encouraged to test the fix and report feedback.