Changed insert and delete to check the text-property field for
authorJason Wilson <edu/mit/csail/zurich/jawilson>
Mon, 9 Aug 1993 19:19:27 +0000 (19:19 +0000)
committerJason Wilson <edu/mit/csail/zurich/jawilson>
Mon, 9 Aug 1993 19:19:27 +0000 (19:19 +0000)
READ-ONLY regions by calling: text-not-insertable? and text-not-deleteable?

v7/src/edwin/grpops.scm

index 0c66a61da94bedfb5a9be172858611db6d4987d0..17d824e2a69a5d3916ef72fb2bf8f5cf66ffaa1c 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: grpops.scm,v 1.18 1993/01/10 10:54:42 cph Exp $
+;;;    $Id: grpops.scm,v 1.19 1993/08/09 19:19:27 jawilson Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-93 Massachusetts Institute of Technology
 ;;;
     unspecific))
 
 (define (prepare-gap-for-insert! group new-start n)
-  (if (group-read-only? group)
+  (if (or (group-read-only? group)
+         (text-not-insertable? group new-start))
       (barf-if-read-only))
   (if (not (group-modified? group))
       (check-first-group-modification group))
               (fix:+ (group-modified-tick group) 1))
   ;; The MODIFIED? bit must be set *after* the undo recording.
   (undo-record-insertion! group index (fix:+ index n))
-  (set-group-modified! group true))
+  (set-group-modified! group true)
+  (update-intervals-for-insertion! group index n))
 \f
 ;;;; Deletions
 
 (define (group-delete! group start end)
   (if (not (fix:= start end))
       (let ((interrupt-mask (set-interrupt-enables! interrupt-mask/gc-ok)))
-       (if (group-read-only? group)
-           (barf-if-read-only))
-       (if (not (group-modified? group))
-           (check-first-group-modification group))
        (let ((text (group-text group))
              (gap-length (group-gap-length group)))
+         (if (or (group-read-only? group)
+                 (text-not-deleteable? group start end))
+             (barf-if-read-only))
+         (if (not (group-modified? group))
+             (check-first-group-modification group))
          ;; Guarantee that the gap is between START and END.  This is
          ;; best done before the undo recording.
          (cond ((fix:< (group-gap-start group) start)
                     (fix:+ (group-modified-tick group) 1))
        ;; The MODIFIED? bit must be set *after* the undo recording.
        (set-group-modified! group true)
+       (update-intervals-for-deletion! group start end)
        (set-interrupt-enables! interrupt-mask)
        unspecific)))
 \f