# HG changeset patch
# User Jan Vrany <jan.vrany@fit.cvut.cz>
# Date 1489791806 0
# Fri Mar 17 23:03:26 2017 +0000
# Branch jv
# Node ID 95c5310f18ea9f5a4ff991fb7d5c7ffdbad0850d
# Parent 637a89222029cee0f892d3b63bd839f94f9af8cc
Issue #124: Fix the corner case when first undo transaction is a complex one
i.e., if the first transation contains more than 2 basic actions (such
as when one replaces selection by pasting). In that ase, we need to create
CompoundAction and add this one to make sure single #undo would undo it
all.
diff -r 637a89222029 -r 95c5310f18ea UndoSupport.st
a
|
b
|
|
156 | 156 | canCombine := false. |
157 | 157 | |
158 | 158 | anUndoList isEmpty ifTrue:[ |
159 | | "/ nothing yet |
160 | | anUndoList addAll:transaction |
| 159 | "/ nothing yet |
| 160 | transaction size > 2 ifTrue:[ |
| 161 | actionToAdd := (CompoundAction new actions:transaction). |
| 162 | actionToAdd info:infoOfCurrentTransaction. |
| 163 | anUndoList add: actionToAdd |
| 164 | ] ifFalse:[ |
| 165 | anUndoList addAll:transaction |
| 166 | ]. |
161 | 167 | ] ifFalse:[ |
162 | 168 | "/ append new actions |
163 | 169 | (infoOfCurrentTransaction isNil and:[ transaction size == 1 ]) ifTrue:[ |
… |
… |
|
192 | 198 | ]. |
193 | 199 | infoOfCurrentTransaction := nil. |
194 | 200 | transaction := nil |
| 201 | |
| 202 | "Modified: / 17-03-2017 / 22:40:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
195 | 203 | ! |
196 | 204 | |
197 | 205 | executeActionFrom:doList addUndoTo:unDoList |
… |
… |
|
317 | 325 | |
318 | 326 | version |
319 | 327 | ^ '$Header$' |
| 328 | ! |
| 329 | |
| 330 | version_HG |
| 331 | |
| 332 | ^ '$Changeset: <not expanded> $' |
320 | 333 | ! ! |
321 | 334 | |