Changeset 6595


Ignore:
Timestamp:
May 25, 2007, 4:47:22 AM (18 years ago)
Author:
Gary Byers
Message:

Keep track of line origin; don't use %buffered-p slot.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ide-1.0/ccl/hemlock/src/line.lisp

    r6582 r6595  
    8585  plist
    8686  ;;
    87   ;; A slot that indicates whether this line is a buffered line, and if so
    88   ;; contains information about how the text is stored.  On the RT, this is
    89   ;; the length of the text pointed to by the Line-%Chars.
    90   (buffered-p ()))
     87  ;; The (logical) origin within a buffer or disembodied region, or NIL
     88  ;; if we aren't sure.
     89  origin)
    9190
    9291
     
    129128              :previous ,previous
    130129              :number ,number
    131               :%buffer ,%buffer
    132               :buffered-p
    133               (line-buffered-p ,line) ))
     130              :%buffer ,%buffer ))
    134131
    135132;;; Hide the fact that the slot isn't really called CHARS.
     
    142139  `(cond ((eq ,line *open-line*)
    143140          (+ *left-open-pos* (- *line-cache-length* *right-open-pos*)))
    144          ((line-buffered-p ,line))
    145141         (t
    146142          (length (the simple-string (line-%chars ,line))))))
     143
     144
     145
     146(defun get-line-origin (line)
     147  (or (line-origin line)
     148      (do* ((prev (line-previous line) (line-previous prev))
     149            (this line))
     150           ((or (null prev) (line-origin this))
     151            (let* ((start (or (line-origin this)
     152                              (setf (line-origin this) 0))))
     153              (do* ((next (line-next this) (line-next next)))
     154                   ((null next) 0)
     155                (incf start (1+ (line-length this)))
     156                (setq this next)
     157                (setf (line-origin this) start)
     158                (when (eq this line) (return start)))))
     159        (setq this prev))))
     160
     161(defun adjust-line-origins-forward (line)
     162  (let* ((stoart (get-line-origin line)))
     163    (do* ((next (line-next line) (line-next next)))
     164         ((null next))
     165      (incf start (1+ (line-length* line)))
     166      (setf (line-origin next) start)
     167      (setq line next))))
Note: See TracChangeset for help on using the changeset viewer.