changeset 23549:aab4ef022ffd

(compose-region): Insert then delete to preserve markers. (decompose-region): Use search-forward for efficiency.
author Kenichi Handa <handa@m17n.org>
date Mon, 26 Oct 1998 08:00:11 +0000
parents 87736ae8e5ff
children d8a958630c9d
files lisp/international/mule-util.el
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/mule-util.el	Mon Oct 26 08:00:11 1998 +0000
+++ b/lisp/international/mule-util.el	Mon Oct 26 08:00:11 1998 +0000
@@ -370,8 +370,8 @@
   (save-excursion
     (let ((str (buffer-substring start end)))
       (goto-char start)
-      (delete-region start end)
-      (insert (compose-string str)))))
+      (insert (compose-string str))
+      (delete-char (- end start)))))
 
 ;;;###autoload
 (defun decompose-region (start end)
@@ -384,13 +384,14 @@
     (save-restriction
       (narrow-to-region start end)
       (goto-char (point-min))
-      (while (not (eobp))
-	(let ((ch (following-char)))
-	  (if (>= ch min-composite-char)
-	      (progn
-		(delete-char 1)
-		(insert (decompose-composite-char ch)))
-	    (forward-char 1)))))))
+      (let ((cmpchar-head (char-to-string leading-code-composition)))
+	(while (search-forward cmpchar-head nil t)
+	  (let ((ch (preceding-char)))
+	    (if (>= ch min-composite-char)
+		(progn
+		  (delete-char -1)
+		  (insert (decompose-composite-char ch)))
+	      (forward-char 1))))))))
 
 ;;;###autoload
 (defun decompose-string (string)