changeset 23992:81b2d3ea98ed

(thai-post-read-conversion): Handle Thai composition sequence correctly here instead of calling thai-compose-region.
author Kenichi Handa <handa@m17n.org>
date Tue, 05 Jan 1999 02:38:37 +0000
parents 3dee93390da0
children d90d3da56713
files lisp/language/thai-util.el
diffstat 1 files changed, 27 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/language/thai-util.el	Mon Jan 04 18:53:32 1999 +0000
+++ b/lisp/language/thai-util.el	Tue Jan 05 02:38:37 1999 +0000
@@ -173,9 +173,33 @@
 (defun thai-post-read-conversion (len)
   (save-excursion
     (save-restriction
-      (let ((buffer-modified-p (buffer-modified-p)))
-	(narrow-to-region (point) (+ (point) len))
-	(thai-compose-region (point-min) (point-max))
+      (let ((buffer-modified-p (buffer-modified-p))
+	    (category-table (category-table))
+	    (buf (current-buffer))
+	    (workbuf (generate-new-buffer "*thai-work*"))
+	    (pos (point))
+	    start end str)
+	(save-excursion
+	  (set-buffer workbuf)
+	  (setq buffer-undo-list t))
+	(narrow-to-region pos (+ pos len))
+	(set-category-table thai-category-table)
+	(unwind-protect
+	    (progn
+	      (while (re-search-forward "\\c+\\c-+" nil t)
+		(setq start (match-beginning 0)
+		      end (point)
+		      str (compose-string (buffer-substring start end)))
+		(set-buffer workbuf)
+		(if (< pos start)
+		    (insert-buffer-substring buf pos start))
+		(insert str)
+		(set-buffer buf)
+		(setq pos end))
+	      (delete-region (point-min) (point))
+	      (insert-buffer-substring workbuf))
+	  (set-category-table category-table)
+	  (kill-buffer workbuf))
 	(set-buffer-modified-p buffer-modified-p)
 	(- (point-max) (point-min))))))