Author: sasugaanija
Date: Wed Sep 26 09:29:38 2007
New Revision: 5016

Modified:
   trunk/emacs/uim-key.el
   trunk/emacs/uim.el

Log:
* Fix bug: Shift + Space is unavailable 
  - Shift + Space is translated into Space before uim process it...
    Thanks Jae-hyeon for the report.

* emacs/uim.el
  - (uim-process-agent-output): Remove shift key from a key vector 
    returned from uim when possible.

* emacs/uim-key.el
  - (uim-check-shift) : New function to check a shift-modifier
    of a key vector.
  - (uim-translate-key): Delete shift-removing parts.




Modified: trunk/emacs/uim-key.el
==============================================================================
--- trunk/emacs/uim-key.el      (original)
+++ trunk/emacs/uim-key.el      Wed Sep 26 09:29:38 2007
@@ -455,6 +455,18 @@
 
 
 
+(defun uim-check-shift (input-vector)
+  (eval (cons 'or
+             (mapcar
+              '(lambda (x)
+                 (or (and uim-emacs
+                          (or (and (integerp x) (/= (logand (lsh 1 25) x) 0))
+                              (string-match "S-" (format "%s" x))))
+                     (and uim-xemacs
+                          (string-match "Sh-" 
+                                        (key-description input-vector)))))
+              (append input-vector nil)))))
+
 
 ;;
 ;; remove Shift modifier from key vector
@@ -598,7 +610,6 @@
   (let (translated-vector map (non-error t)
        (input-vector-main input-vector)
        (input-vector-prefix nil)
-       input-vector-main-backup
        translated bind)
 
     (uim-debug (format "input-vector: %s" input-vector))
@@ -606,8 +617,6 @@
     (catch 'fmap-loop
       (while input-vector-main
 
-       (setq input-vector-main-backup input-vector-main)
-
        (setq bind (uim-key-binding input-vector-main))
          
        (if (and bind
@@ -626,37 +635,6 @@
              (setq translated (lookup-key local-function-key-map 
                                           input-vector-main)))
          
-         (if (or (not translated)
-                 (integerp translated))
-             (progn
-               (setq input-vector-main (uim-remove-shift input-vector-main))
-
-               (setq bind (uim-key-binding input-vector-main))
-
-               (if (and bind 
-                        (not (integerp bind)))
-
-                   (progn
-                     (uim-debug "skip function-key-map lookup (remove shift)")
-                     ;;(setq translated-vector input-vector)
-                     (setq translated-vector 
-                           (vconcat input-vector-prefix input-vector-main))
-                     (throw 'fmap-loop t))
-
-                 (setq translated (lookup-key function-key-map 
-                                              input-vector-main))
-
-                 (if (and (or (not translated)
-                              (integerp translated))
-                          (boundp 'local-function-key-map))
-                     (setq translated (lookup-key local-function-key-map 
-                                                  input-vector-main)))
-
-                 (uim-debug "*** cannot remove shift")
-
-                 (if (not translated)
-                     (setq input-vector-main input-vector-main-backup)))))
-
          (cond ((not translated)
                 )
 
@@ -710,7 +688,6 @@
                 (throw 'fmap-loop t))
                ))
 
-       (setq input-vector-main input-vector-main-backup)
 
        (setq input-vector-prefix
              (vconcat input-vector-prefix (uim-vector-car input-vector-main)))

Modified: trunk/emacs/uim.el
==============================================================================
--- trunk/emacs/uim.el  (original)
+++ trunk/emacs/uim.el  Wed Sep 26 09:29:38 2007
@@ -1401,11 +1401,20 @@
                    (if uim-prefix-arg
                        (setq count (prefix-numeric-value uim-prefix-arg)))
 
-                   (when (uim-process-key-vector key count)
-                     ;;(setq uim-stacked-key-vector key)
-                     (setq uim-wait-next-key t)
-                     ;;(setq uim-prefix-arg count)
-                     )
+                   ;; remove shift if possible
+                   (if (and (uim-check-shift key)
+                            (not (uim-key-binding key)))
+                       ;; with shift key but no key bind
+                       (let* ((keytmp (uim-remove-shift key))
+                              (translated (nth 0 (uim-translate-key keytmp))))
+                         ;; lookup function-key-map
+                         (if translated
+                             (setq key translated)
+                           (if (uim-key-binding keytmp)
+                               (setq key keytmp)))))
+
+                   (if (uim-process-key-vector key count)
+                       (setq uim-wait-next-key t))
                    (setq keyproc-done t))
                (when (not keyproc-done)
                  (uim-leave-preedit-mode)

Reply via email to