Changeset 12148


Ignore:
Timestamp:
May 27, 2009, 9:24:39 PM (10 years ago)
Author:
gb
Message:

Apple's Find/Replace? panel calls
#/replaceCharactersInRange:withString: without wrapping #/beginEditing
and #/endEditing around that call. (ticket:504).

After #/paste, call UPDATE-HEMLOCK-SELECTION. (This is one way of ensuring
that redisplay happens when background layout is disabled, as it is in
listeners.) We may need to implement some more general text view "finished
editing" method to ensure that this happens when it should. (ticket:505).

File:
1 edited

Legend:

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

    r12125 r12148  
    790790         (length (pref r :<NSR>ange.length))
    791791         (lisp-string (if (> (#/length string) 0) (lisp-string-from-nsstring string)))
    792          (view (front-view-for-buffer buffer)))
    793     (hi::with-mark ((m (hi::buffer-point buffer)))
    794       (hi::move-to-absolute-position m position)
    795       (when (> length 0)
    796         (hi::delete-characters m length))
    797       (when lisp-string
    798         (hi::insert-string m lisp-string)))
     792         (view (front-view-for-buffer buffer))
     793         (edit-count (slot-value self 'edit-count)))
     794    ;; #!#@#@* find panel neglects to call #/beginEditing / #/endEditing.
     795    (when (eql 0 edit-count)
     796      (#/beginEditing self))
     797    (unwind-protect
     798         (hi::with-mark ((m (hi::buffer-point buffer)))
     799           (hi::move-to-absolute-position m position)
     800           (when (> length 0)
     801             (hi::delete-characters m length))
     802           (when lisp-string
     803             (hi::insert-string m lisp-string)))
     804      (when (eql 0 edit-count)
     805        (#/endEditing self)))
    799806    (when view
    800807      (setf (hi::hemlock-view-quote-next-p view) nil))))
     
    989996  ;; If no modifier keys are pressed, send hemlock a no-op.
    990997  ;; (Or almost a no-op - this does an update-hemlock-selection as a side-effect)
     998
    991999  (unless (logtest #$NSDeviceIndependentModifierFlagsMask (#/modifierFlags event))
    9921000    (let* ((view (hemlock-view self)))
     
    30753083          (#/beginEditing textstorage)
    30763084          (#/replaceCharactersInRange:withString: textstorage selectedrange string)
    3077           (#/endEditing textstorage))))))
     3085          (#/endEditing textstorage)
     3086          (update-hemlock-selection textstorage) )))))
    30783087
    30793088
Note: See TracChangeset for help on using the changeset viewer.