changeset 19744:b1774d359a3d

(quail-update-translation): Do insert translated char when enable-multibyte-characters is nil.
author Richard M. Stallman <rms@gnu.org>
date Thu, 04 Sep 1997 04:47:34 +0000
parents b228f82192d5
children 356bc22e88f6
files lisp/international/quail.el
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/quail.el	Thu Sep 04 03:31:10 1997 +0000
+++ b/lisp/international/quail.el	Thu Sep 04 04:47:34 1997 +0000
@@ -1062,8 +1062,21 @@
 	      (setq unread-command-events
 		    (cons (aref quail-current-key len)
 			  unread-command-events)))
-	    (insert (or quail-current-str
-			(substring quail-current-key 0 len))))
+	    ;; Insert the translated sequence.
+	    ;; It is a string containing multibyte characters.
+	    ;; If enable-multibyte-characters, just insert it.
+	    (if enable-multibyte-characters
+		(insert (or quail-current-str
+			    (substring quail-current-key 0 len)))
+	      ;; Otherwise, in case the user is using a single-byte
+	      ;; extended-ASCII character set,
+	      ;; try inserting the translated character.
+	      (let ((char (sref (or quail-current-str
+				    (substring quail-current-key 0 len))
+				0)))
+		(if (= (length (split-char char)) 2)
+		    (insert-char (logand char 127))
+		  (error "Cannot insert three-byte character in single-byte mode")))))
 	(insert (or quail-current-str quail-current-key)))))
   (quail-update-guidance)
   (if control-flag