Changeset 11732


Ignore:
Timestamp:
Feb 12, 2009, 7:24:28 PM (10 years ago)
Author:
gb
Message:

Implement #/paste for HEMLOCK-TEXTSTORAGE-TEXT-VIEW (the superclass of
HEMLOCK-TEXT-VIEW and ECHO-AREA-VIEW.) This does CRLF translation of
whatever's on the clipboard; more significantly, it neglects to
surround the call to #/replaceCharactersInRange:withString: with
#/beginEditing / #/endEditing. Our implementation of
#/replaceCharactersInRange:withString: calls code that incorrectly
expects that editing is -not- in progress when it's called (if it
checks for anything, it should insist that editing's in progress.
This seems to be a large part of the problem with tickets 258, 424,
and others; this change doesn't fix that problem, but ensures that
echo areas use a buggy #/paste implementation that gets along better
with the buggy #/replaceCharactersInRange:withString:, so the worst
symptom of ticket:258 (assertion failures and/or crashes) doesn't
appear. The recursive edit/recursive event loop code doesn't seem
to recognize that the buffer's changing behind its back as a result
of #/paste or other non-Hemlock commands.

File:
1 edited

Legend:

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

    r11619 r11732  
    29392939;;; we may need to continue to override this method in order to
    29402940;;; fix that.)
    2941 (objc:defmethod (#/paste: :void) ((self hemlock-text-view) sender)
     2941(objc:defmethod (#/paste: :void) ((self hemlock-textstorage-text-view) sender)
    29422942  (declare (ignorable sender))
    29432943  #+debug (#_NSLog #@"Paste: sender = %@" :id sender)
     
    29542954          (#/setSelectedRange: self (ns:make-ns-range (#/length textstorage) 0)))
    29552955        (let* ((selectedrange (#/selectedRange self)))
    2956           (#/replaceCharactersInRange:withString: textstorage selectedrange string))))))
     2956          ;; We really should bracket the call to
     2957          ;; #/repaceCharactersInRange:withString: here with calls
     2958          ;; to #/beginEditing and #/endEditing, but our implementation
     2959          ;; of #/replaceCharactersInRange:withString: calls code that
     2960          ;; asserts that editing isn't in progress.  Once that's
     2961          ;; fixed, this should be fixed as well.
     2962          #+not-broken (#/beginEditing textstorage)
     2963          (#/replaceCharactersInRange:withString: textstorage selectedrange string)
     2964          #+not-broken (#/endEditing self))))))
    29572965
    29582966
Note: See TracChangeset for help on using the changeset viewer.