Changeset 7552


Ignore:
Timestamp:
Oct 30, 2007, 5:41:20 PM (12 years ago)
Author:
jaj
Message:

Add support for redo.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/cocoa-ide/cocoa-editor.lisp

    r7541 r7552  
    614614(objc:defmethod (#/replaceCharactersAtPosition:length:withString: :void)
    615615    ((self hemlock-text-storage) (pos <NSUI>nteger) (len <NSUI>nteger) string)
    616   (ns:with-ns-range (r pos len)
    617     (#/replaceCharactersInRange:withString: self r string)))
     616  (let* ((document (#/document self))
     617         (undo-mgr (and document (#/undoManager document))))
     618    (when (and undo-mgr (not (#/isRedoing undo-mgr)))
     619      (let ((replaced-string (#/substringWithRange: (#/hemlockString self) (ns:make-ns-range pos len))))
     620        (#/replaceCharactersAtPosition:length:withString:
     621         (#/prepareWithInvocationTarget: undo-mgr self)
     622         pos (#/length string) replaced-string)))
     623    (ns:with-ns-range (r pos len)
     624      (#/replaceCharactersInRange:withString: self r string))))
    618625
    619626(objc:defmethod (#/replaceCharactersInRange:withString: :void)
Note: See TracChangeset for help on using the changeset viewer.