Changeset 14481
- Timestamp:
- Dec 11, 2010, 9:27:28 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/cocoa-ide/cocoa-editor.lisp
r14429 r14481 3368 3368 *nsapp* (@selector #/stringToPasteBoard:) (%make-nsstring string) t))) 3369 3369 3370 #+cocotron 3371 ;;; Work around a byte-order bug that affects #/paste. 3372 (defun maybe-byte-reverse-string (nsstring) 3373 (let* ((len (#/length nsstring)) 3374 (maybe-reversed-count 0)) 3375 (dotimes (i len) 3376 (when (not (logtest #xff (#/characterAtIndex: nsstring i))) 3377 (incf maybe-reversed-count))) 3378 (if (> maybe-reversed-count (ash len -1)) 3379 (%stack-block ((chars (* 2 len))) 3380 (ns:with-ns-range (r 0 len) 3381 (#/getCharacters:range: nsstring chars r) 3382 (dotimes (i len) 3383 (declare (fixnum i)) 3384 (let* ((j (+ i i))) 3385 (declare (fixnum j)) 3386 (let* ((w (%get-unsigned-word chars j))) 3387 (setf (%get-unsigned-word chars j) 3388 (dpb (ldb (byte 8 0) w) 3389 (byte 8 8) 3390 (ldb (byte 8 8) w)))))) 3391 3392 3393 (#/autorelease 3394 (make-instance ns:ns-string 3395 :with-characters chars 3396 :length len)))) 3397 nsstring))) 3398 3399 3400 3370 3401 ;;; The default #/paste method seems to want to set the font to 3371 3402 ;;; something ... inappropriate. If we can figure out why it … … 3383 3414 #+debug (log-debug " string = ~s" string) 3384 3415 (unless (%null-ptr-p string) 3416 #+cocotron (setq string (maybe-byte-reverse-string string)) 3385 3417 (unless (zerop (ns:ns-range-length (#/rangeOfString: string *ns-cr-string*))) 3386 3418 (setq string (make-instance 'ns:ns-mutable-string :with-string string))
Note: See TracChangeset
for help on using the changeset viewer.