Ticket #124: libbasic2_fix_1_of_1_rev_95c5310f18ea_Issue__124__Fix_the_corner_case_when_first_undo_transaction_is_a_complex_one.patch

File libbasic2_fix_1_of_1_rev_95c5310f18ea_Issue__124__Fix_the_corner_case_when_first_undo_transaction_is_a_complex_one.patch, 1.6 KB (added by jan vrany, 7 years ago)
  • UndoSupport.st

    # 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  
    156156        canCombine := false.
    157157       
    158158        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            ].
    161167        ] ifFalse:[
    162168            "/ append new actions
    163169            (infoOfCurrentTransaction isNil and:[ transaction size == 1 ]) ifTrue:[
     
    192198    ].
    193199    infoOfCurrentTransaction := nil.
    194200    transaction := nil
     201
     202    "Modified: / 17-03-2017 / 22:40:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    195203!
    196204
    197205executeActionFrom:doList addUndoTo:unDoList
     
    317325
    318326version
    319327    ^ '$Header$'
     328!
     329
     330version_HG
     331
     332    ^ '$Changeset: <not expanded> $'
    320333! !
    321334