]> git.eshelyaron.com Git - emacs.git/commitdiff
(terminal-composition-base-character-p): New
authorKenichi Handa <handa@m17n.org>
Thu, 26 Jun 2008 04:17:19 +0000 (04:17 +0000)
committerKenichi Handa <handa@m17n.org>
Thu, 26 Jun 2008 04:17:19 +0000 (04:17 +0000)
funciton.
(terminal-composition-function): Use
terminal-composition-base-character-p.  Include the base character
in the composition.
(auto-compose-chars): Don't check font-object for terminal
display.

lisp/ChangeLog
lisp/composite.el

index 76728eca4b8b8f4df500c30526cb62c40392bc9e..0dcebf8ca69c2a150c11e2f7b2680a6806e770ca 100644 (file)
@@ -1,3 +1,13 @@
+2008-06-26  Kenichi Handa  <handa@m17n.org>
+
+       * composite.el (terminal-composition-base-character-p): New
+       funciton.
+       (terminal-composition-function): Use
+       terminal-composition-base-character-p.  Include the base character
+       in the composition.
+       (auto-compose-chars): Don't check font-object for terminal
+       display.
+
 2008-06-26  Glenn Morris  <rgm@gnu.org>
 
        * calendar/calendar.el (calendar-date-echo-text): Doc fix.
index 3106f726ed5779afcbd635c7296da560590384d8..0d4912be7478fbc2f6c6d30aad6d287876836aac 100644 (file)
@@ -436,26 +436,32 @@ See also the documentation of `auto-composition-mode'.")
 
 (put 'save-buffer-state 'lisp-indent-function 1)
 
+(defsubst terminal-composition-base-character-p (ch)
+  (not (memq (get-char-code-property ch 'general-category)
+            '(Mn Mc Me Zs Zl Zp Cc Cf Cs))))
+
 (defun terminal-composition-function (from to font-object string)
   "General composition function used on terminal.
 Non-spacing characters are composed with the preceding spacing
 character.  All non-spacing characters has this function in
 `terminal-composition-function-table'."
-  (let ((pos (1+ from)))
+  (let ((pos from))
     (if string
        (progn
          (while (and (< pos to)
                      (= (aref char-width-table (aref string pos)) 0))
            (setq pos (1+ pos)))
-         (if (> from 0)
+         (if (and (> from 0)
+                  (terminal-composition-base-character-p (aref string (1- from))))
              (compose-string string (1- from) pos)
            (compose-string string from pos
                            (concat " " (buffer-substring from pos)))))
       (while (and (< pos to)
                  (= (aref char-width-table (char-after pos)) 0))
        (setq pos (1+ pos)))
-      (if (> from (point-min))
-         (compose-region (1- from) pos (buffer-substring from pos))
+      (if (and (> from (point-min))
+              (terminal-composition-base-character-p (char-after pos)))
+         (compose-region (1- from) pos)
        (compose-region from pos
                        (concat " " (buffer-substring from pos)))))
     pos))
@@ -496,7 +502,8 @@ This function is the default value of `auto-composition-function' (which see)."
                         (elt (aref table ch))
                         font-obj newpos)
                    (when (and elt
-                              (setq font-obj (font-at from window string)))
+                              (or (not (display-graphic-p))
+                                  (setq font-obj (font-at from window string))))
                      (if (functionp elt)
                          (setq newpos (funcall elt from to font-obj string))
                        (while (and elt
@@ -517,7 +524,8 @@ This function is the default value of `auto-composition-function' (which see)."
                         (elt (aref table ch))
                         func pattern font-obj newpos)
                    (when (and elt
-                              (setq font-obj (font-at from window)))
+                              (or (not (display-graphic-p))
+                                  (setq font-obj (font-at from window))))
                      (if (functionp elt)
                          (setq newpos (funcall elt from to font-obj nil))
                        (goto-char from)