Changeset 14560


Ignore:
Timestamp:
Jan 7, 2011, 10:18:51 AM (14 years ago)
Author:
R. Matthew Emerson
Message:

Go back to using temporary attributes for paren highlighting when
#-cocotron.

File:
1 edited

Legend:

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

    r14536 r14560  
    11321132                                                       
    11331133
    1134 ;;; This assumes that NSBackgroundColorAttributeName can only be
    1135 ;;; present id it's (possibly stale) paren highlighting info.
    1136 ;;; We can't be sure of the locations (because of insertions/deletions),
    1137 ;;; so remove the attribute from the entire textstorage.
    11381134(defmethod remove-paren-highlight ((self hemlock-textstorage-text-view))
     1135  #-cocotron
     1136  (let* ((left (text-view-paren-highlight-left-pos self))
     1137         (right (text-view-paren-highlight-right-pos self)))
     1138    (ns:with-ns-range (char-range left 1)
     1139      (let* ((layout (#/layoutManager self)))
     1140        (#/removeTemporaryAttribute:forCharacterRange: layout
     1141                                                       #&NSBackgroundColorAttributeName
     1142                                                       char-range)
     1143        (setf (pref char-range #>NSRange.location) right)
     1144        (#/removeTemporaryAttribute:forCharacterRange: layout
     1145                                                       #&NSBackgroundColorAttributeName
     1146                                                       char-range))))
     1147  ;;; This assumes that NSBackgroundColorAttributeName can only be
     1148  ;;; present id it's (possibly stale) paren highlighting info.
     1149  ;;; We can't be sure of the locations (because of insertions/deletions),
     1150  ;;; so remove the attribute from the entire textstorage.
     1151  #+cocotron
    11391152  (let* ((textstorage (#/textStorage self))
    11401153         (len (#/length textstorage)))
    11411154    (#/beginEditing textstorage)
    1142     (ns:with-ns-range  (char-range 0 len)
     1155    (ns:with-ns-range (char-range 0 len)
    11431156      (#/removeAttribute:range: textstorage #&NSBackgroundColorAttributeName
    11441157                                char-range))
     
    11901203           (attrs (#/dictionaryWithObject:forKey: ns:ns-dictionary
    11911204                                                  paren-highlight-color
    1192                                                   background))
    1193            (ts (#/textStorage self)))
     1205                                                  background)))
    11941206      (ns:with-ns-range (left-range paren-highlight-left 1)
    11951207        (ns:with-ns-range (right-range paren-highlight-right 1)
    1196           (#/beginEditing ts)
    1197           (#/addAttributes:range: ts attrs left-range)
    1198           ;;(#/edited:range:changeInLength: ts #$NSTextStorageEditedAttributes left-range 0)
    1199           (#/addAttributes:range: ts attrs right-range)
    1200           ;;(#/edited:range:changeInLength: ts #$NSTextStorageEditedAttributes right-range 0)
    1201           (#/endEditing ts))))))
     1208          #-cocotron
     1209          (let ((layout (#/layoutManager (#/textContainer self))))
     1210            (#/addTemporaryAttributes:forCharacterRange: layout attrs left-range)
     1211            (#/addTemporaryAttributes:forCharacterRange: layout attrs right-range))
     1212          #+cocotron
     1213          (let ((ts (#/textStorage self)))
     1214            (#/beginEditing ts)
     1215            (#/addAttributes:range: ts attrs left-range)
     1216            (#/addAttributes:range: ts attrs right-range)
     1217            (#/endEditing ts)))))))
    12021218
    12031219(defmethod update-paren-highlight ((self hemlock-textstorage-text-view))
Note: See TracChangeset for help on using the changeset viewer.