[Openmcl-devel] patches, and a question

alex crain alexcrain at mail2.widgetworks.com
Wed Oct 6 09:35:52 PDT 2004


I've attached some diffs to fix a really annoying bug in the cocoa 
listener window where
if you selected a region with apple-C and tried to paste into a region 
outside of the
input line (ie: somewhere in the command history) the system would die 
a death of
a thousand event loop errors.

(there's also a patch that fixes the width of the typeout window. We 
can rethink this later
but it works well for the moment).

The new behavior is the similar to that of the terminal window: if you 
try to paste
anywhere except the current input line, the text is appended to the end 
of the input line.
More importantly, the system doesn't hang.

The editor window and the listener window use hemlock-text-storage
as a place to put the text, so I added a flag to the class to indicate 
that listener windows
should exhibit my new behavior. That way when 
replaceCharactersInRange:withString:
is invoked during a paste, the system can put the text in the right 
place.

(defclass hemlock-text-storage (ns:ns-text-storage)
     ((string :foreign-type :id)
      (edit-count :foreign-type :int)
      (append-edits :foreign-type :int))
   (:metaclass ns:+ns-object))

Then, when I build the listener, I can do this:

(setf (slot-value (slot-value self 'textstorage) 'append-edits) 1)

My question is this: If the append-edits slot is a native lisp type,
and set the value to t, the call to setf generates the error:

2004-10-06 12:08:11.958 [9774] Error in event loop: 
#<HEMLOCK-TEXT-STORAGE HemlockTextStorage : string <HemlockBufferString 
for #<Hemlock Buffer "Untitled">> (#x184550)> has no slots.

But if I make it :foreign-type and set the value to 1, it works.

Why?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFFS
Type: application/octet-stream
Size: 5306 bytes
Desc: not available
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20041006/3ad17f1b/attachment.obj>


More information about the Openmcl-devel mailing list