Changeset 12255


Ignore:
Timestamp:
Jun 11, 2009, 12:45:43 AM (10 years ago)
Author:
rme
Message:

Define a charprops-change structure and add a charprops-changes slot
to Hemlock's line object. When a line is copied, also copy the
charprops-changes.

File:
1 edited

Legend:

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

    r7595 r12255  
    8787  ;; The (logical) origin within a buffer or disembodied region, or NIL
    8888  ;; if we aren't sure.
    89   origin)
     89  origin
     90  ;; A vector of charprops-change objects or NIL if the whole line has
     91  ;; the buffer's default character properties.
     92  charprops-changes)
    9093
     94(defstruct (charprops-change
     95            (:copier nil)
     96            (:constructor make-charprops-change (index plist)))
     97  index
     98  plist)
    9199
    92 
     100(defun copy-charprops-change (c)
     101  (make-charprops-change (charprops-change-index c)
     102                         (copy-list (charprops-change-plist c))))
    93103
    94104;;; If buffered lines are supported, then we create the string
     
    119129  (line-%chars line))
    120130
     131(defun copy-charprops-changes (changes)
     132  (when changes
     133    (let* ((new (make-array (length changes) :adjustable t :fill-pointer 0)))
     134      (map-into new #'copy-charprops-change changes))))
    121135
    122136;;; Return a copy of Line in buffer Buffer with the same chars.  We use
     
    126140(defmacro %copy-line (line &key previous number %buffer)
    127141  `(make-line :chars (line-%chars ,line)
     142              :charprops-changes (copy-charprops-changes
     143                                  (line-charprops-changes ,line))
    128144              :previous ,previous
    129145              :number ,number
Note: See TracChangeset for help on using the changeset viewer.