emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/crdt 9c37d4d 19/80: remove superfluous crdt--inhibit-up


From: ELPA Syncer
Subject: [elpa] externals/crdt 9c37d4d 19/80: remove superfluous crdt--inhibit-update bind
Date: Sat, 28 Aug 2021 10:57:33 -0400 (EDT)

branch: externals/crdt
commit 9c37d4d6fb7ec645e63b29253f6a273b2ed05e3d
Author: Qiantan Hong <qhong@mit.edu>
Commit: Qiantan Hong <qhong@mit.edu>

    remove superfluous crdt--inhibit-update bind
---
 crdt.el | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/crdt.el b/crdt.el
index 0e7be00..621a546 100644
--- a/crdt.el
+++ b/crdt.el
@@ -671,22 +671,23 @@ Start the search from POS."
                    right-pos))))))))
 
 (defun crdt--remote-insert (id position-hint content)
-  (let ((crdt--inhibit-update t))
-    (let* ((beg (crdt--find-id id position-hint)) end)
-      (goto-char beg)
-      (insert content)
-      (setq end (point))
-      (with-silent-modifications
-        (crdt--with-insertion-information
-         (beg end)
-         (let ((base-length (- (string-bytes starting-id) 2)))
-           (if (and (eq (string-bytes id) (string-bytes starting-id))
-                    (eq t (compare-strings starting-id 0 base-length
-                                           id 0 base-length))
-                    (eq (1+ left-offset) (crdt--id-offset id)))
-               (put-text-property beg end 'crdt-id starting-id-pair)
-             (put-text-property beg end 'crdt-id (cons id t))))
-         (crdt--split-maybe)))))
+  (let* ((beg (crdt--find-id id position-hint)) end)
+    (goto-char beg)
+    (insert content)
+    (setq end (point))
+    (unless (get-text-property end 'crdt-id)
+      (setq end (next-single-property-change end 'crdt-id nil (point-max))))
+    (with-silent-modifications
+      (crdt--with-insertion-information
+       (beg end)
+       (let ((base-length (- (string-bytes starting-id) 2)))
+         (if (and (eq (string-bytes id) (string-bytes starting-id))
+                  (eq t (compare-strings starting-id 0 base-length
+                                         id 0 base-length))
+                  (eq (1+ left-offset) (crdt--id-offset id)))
+             (put-text-property beg end 'crdt-id starting-id-pair)
+           (put-text-property beg end 'crdt-id (cons id t))))
+       (crdt--split-maybe))))
   ;; (crdt--verify-buffer)
   )
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]