Changeset 12556


Ignore:
Timestamp:
Aug 8, 2009, 4:45:45 AM (10 years ago)
Author:
rme
Message:

Instead of calling hi:move-to-absolute-position, use the function
move-hemlock-mark-to-absolute-position, which uses the cache.

File:
1 edited

Legend:

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

    r12554 r12556  
    3333        (setf hi::*current-buffer* nil))
    3434      (setf (hi::buffer-document buffer) nil)
    35       (hi::delete-buffer buffer)
     35      ;; It makes sense to me to delete the buffer here, but
     36      ;; the existing code does it in response to closing a document.
     37      ;;(hi::delete-buffer buffer)
    3638      (setf (slot-value self 'cache) nil)
    3739      (call-next-method))))
     
    4244                ((self xhemlock-buffer-string) (range #>NSRange) string)
    4345  (let* ((buffer (hemlock-buffer self))
     46         (cache (hemlock-buffer-string-cache self))
    4447         (hi::*current-buffer* buffer)
    4548         (position (pref range #>NSRange.location))
     
    4750         (lisp-string (if (> (#/length string) 0) (lisp-string-from-nsstring string))))
    4851    (hi:with-mark ((m (hi:buffer-point buffer)))
    49       (hi:move-to-absolute-position m position)
     52      (move-hemlock-mark-to-absolute-position m cache position)
    5053      (when (> length 0)
    5154        (hi:delete-characters m length))
     
    155158                                                (attributes :id)
    156159                                                (range #>NSRange))
    157   (let* ((buffer (hemlock-buffer (hemlock-string self)))
     160  (let* ((string (hemlock-string self))
     161         (cache (hemlock-buffer-string-cache self))
     162         (buffer (hemlock-buffer string))
    158163         (hi::*current-buffer* buffer)
    159164         (*suppress-edit-notifications* t))
    160165    (hi:with-mark ((start (hi:buffer-point buffer))
    161166                   (end (hi:buffer-point buffer)))
    162       (hi:move-to-absolute-position start (ns:ns-range-location range))
    163       (hi:move-to-absolute-position end (+ (ns:ns-range-location range)
    164                                            (ns:ns-range-length range)))
     167      (move-hemlock-mark-to-absolute-position start cache
     168                                              (ns:ns-range-location range))
     169      (move-hemlock-mark-to-absolute-position end cache
     170                                              (+ (ns:ns-range-location range)
     171                                                 (ns:ns-range-length range)))
    165172      (hi::set-region-charprops (hi:region start end) (dict-to-charprops attributes))))
    166173  (#/edited:range:changeInLength: self #$NSTextStorageEditedAttributes
     
    174181         (hi::*current-buffer* buffer))
    175182    (hi:with-mark ((m (hi:buffer-point buffer)))
    176       (hi:move-to-absolute-position m location)
     183      (move-hemlock-mark-to-absolute-position m
     184                                              (hemlock-buffer-string-cache
     185                                               (hemlock-string self))
     186                                              location)
    177187      (multiple-value-bind (plist start end)
    178188                           (hi::line-charprops-for-position (hi:mark-line m) (hi:mark-charpos m))
Note: See TracChangeset for help on using the changeset viewer.