Typed characters are now grouped properly by undo regardless of their
authorChris Hanson <org/chris-hanson/cph>
Sun, 10 Jan 1993 10:46:38 +0000 (10:46 +0000)
committerChris Hanson <org/chris-hanson/cph>
Sun, 10 Jan 1993 10:46:38 +0000 (10:46 +0000)
position on the line.

v7/src/edwin/comred.scm

index 728be5516415aac487f64beb0a1cf7a9a1292ba0..88acd09c7079c674a1a0626e724dfa060db5d935 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: comred.scm,v 1.95 1993/01/09 01:16:01 cph Exp $
+;;;    $Id: comred.scm,v 1.96 1993/01/10 10:46:38 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-93 Massachusetts Institute of Technology
 ;;;
     (let ((normal
           (lambda ()
             (set! *non-undo-count* 0)
-            (undo-boundary! point)
+            (if (not *command-argument*)
+                (undo-boundary! point))
             (apply procedure (interactive-arguments command record?)))))
       (cond ((or *executing-keyboard-macro?* *command-argument*)
-            (set! *non-undo-count* 0)
-            (apply procedure (interactive-arguments command record?)))
-           ((window-needs-redisplay? window)
             (normal))
            ((and (char? *command-key*)
                  (or (eq? command (ref-command-object self-insert-command))
                      (and (eq? command (ref-command-object &auto-fill-space))
                           (not (auto-fill-break? point)))
                      (command-argument-self-insert? command)))
-            (let ((key *command-key*))
-              (if (let ((buffer (window-buffer window)))
-                    (and (buffer-auto-save-modified? buffer)
-                         (null? (cdr (buffer-windows buffer)))
-                         (line-end? point)
-                         (char-graphic? key)
-                         (fix:< point-x (fix:- (window-x-size window) 1))))
+            (let ((non-undo-count *non-undo-count*))
+              (if (or (fix:= non-undo-count 0)
+                      (fix:>= non-undo-count 20))
                   (begin
-                    (if (fix:< *non-undo-count* 20)
-                        (set! *non-undo-count* (fix:+ *non-undo-count* 1))
-                        (begin
-                          (set! *non-undo-count* 1)
-                          (undo-boundary! point)))
-                    (window-direct-output-insert-char! window key))
-                  (begin
-                    (set! *non-undo-count* 0)
-                    (undo-boundary! point)
-                    (region-insert-char! point key)))))
+                    (set! *non-undo-count* 1)
+                    (undo-boundary! point))
+                  (set! *non-undo-count* (fix:+ non-undo-count 1))))
+            (let ((key *command-key*))
+              (if (and (not (window-needs-redisplay? window))
+                       (let ((buffer (window-buffer window)))
+                         (and (buffer-auto-save-modified? buffer)
+                              (null? (cdr (buffer-windows buffer)))))
+                       (line-end? point)
+                       (char-graphic? key)
+                       (fix:< point-x (fix:- (window-x-size window) 1)))
+                  (window-direct-output-insert-char! window key)
+                  (region-insert-char! point key))))
            ((eq? command (ref-command-object forward-char))
-            (if (and (not (group-end? point))
+            (if (and (not (window-needs-redisplay? window))
+                     (not (group-end? point))
                      (char-graphic? (mark-right-char point))
                      (fix:< point-x (fix:- (window-x-size window) 2)))
                 (window-direct-output-forward-char! window)
                 (normal)))
            ((eq? command (ref-command-object backward-char))
-            (if (and (not (group-start? point))
+            (if (and (not (window-needs-redisplay? window))
+                     (not (group-start? point))
                      (char-graphic? (mark-left-char point))
                      (fix:< 0 point-x)
                      (fix:< point-x (fix:- (window-x-size window) 1)))