Revision: 6929
Author: deton.kih
Date: Fri Jan 28 16:03:19 2011
Log: * Add postfix mazegaki conversion.
* scm/tutcode.scm
  - (tutcode-context-rec-spec): Add postfix-yomi-len.
  - (tutcode-commit-with-auto-help):
    Add call of delete-text for postfix mazegaki commit.
  - (tutcode-begin-conversion):
    Change to return whether candidate was found for relimit yomi.
  - (tutcode-begin-conversion-with-relimit-right): New.
  - (tutcode-stroke-help-update-alist-with-rule):
    Add label for postfix mazegaki start sequences.
  - (tutcode-commit-editor-context):
    Add call of delete-text for postfix mazegaki commit.
  - (tutcode-proc-state-on):
    Add reset of postfix-yomi-len for prefix conversion.
    Add call of tutcode-begin-postfix-mazegaki-conversion
    for postfix mazegaki start sequences.
  - (tutcode-begin-postfix-mazegaki-conversion): New.
  - (tutcode-back-to-yomi-state):
    Change to set state proc-on when postfix mazegaki conversion.
  - (tutcode-proc-state-converting):
    Add relimit of yomi and reconversion while postfix mazegaki conversion.
    Add call of delete-text for postfix mazegaki commit.
  - (tutcode-key-press-handler):
    Add update of preedit when recursive learning is canceled
    from postfix mazegaki.
  - (tutcode-custom-set-mazegaki/bushu-start-sequence!):
    Add rules for postfix mazegaki start sequence.
* scm/tutcode-custom.scm
  - (tutcode-mazegaki-yomi-max): New custom.
* scm/tutcode-key-custom.scm
  - (tutcode-postfix-mazegaki-start-sequence,
     tutcode-postfix-mazegaki-1-start-sequence,
     tutcode-postfix-mazegaki-2-start-sequence,
     tutcode-postfix-mazegaki-3-start-sequence,
     tutcode-postfix-mazegaki-4-start-sequence,
     tutcode-postfix-mazegaki-5-start-sequence,
     tutcode-postfix-mazegaki-6-start-sequence,
     tutcode-postfix-mazegaki-7-start-sequence,
     tutcode-postfix-mazegaki-8-start-sequence,
     tutcode-postfix-mazegaki-9-start-sequence,
     tutcode-postfix-mazegaki-relimit-left-key,
     tutcode-postfix-mazegaki-relimit-right-key): New custom key.

http://code.google.com/p/uim/source/detail?r=6929

Modified:
 /trunk/scm/tutcode-custom.scm
 /trunk/scm/tutcode-key-custom.scm
 /trunk/scm/tutcode.scm

=======================================
--- /trunk/scm/tutcode-custom.scm       Thu Jan  6 18:09:56 2011
+++ /trunk/scm/tutcode-custom.scm       Fri Jan 28 16:03:19 2011
@@ -106,6 +106,12 @@
   (N_ "Enable two stroke kigou mode")
   (N_ "long description will be here."))

+(define-custom 'tutcode-mazegaki-yomi-max 10
+  '(tutcode candwin)
+  '(integer 0 99)
+  (N_ "Maximum length of yomi for postfix mazegaki conversion")
+  (N_ "long description will be here."))
+
 (define-custom 'tutcode-use-interactive-bushu-conversion? #f
   '(tutcode tutcode-bushu)
   '(boolean)
=======================================
--- /trunk/scm/tutcode-key-custom.scm   Thu Jan  6 18:09:56 2011
+++ /trunk/scm/tutcode-key-custom.scm   Fri Jan 28 16:03:19 2011
@@ -95,6 +95,66 @@
               (N_ "[TUT-Code] postfix bushu conversion")
               (N_ "long description will be here"))

+(define-custom 'tutcode-postfix-mazegaki-start-sequence ""
+               '(tutcode-keys1)
+              '(string ".*")
+              (N_ "[TUT-Code] postfix mazegaki conversion")
+              (N_ "long description will be here"))
+
+(define-custom 'tutcode-postfix-mazegaki-1-start-sequence ""
+               '(tutcode-keys1)
+              '(string ".*")
+              (N_ "[TUT-Code] postfix mazegaki conversion with yomi 1")
+              (N_ "long description will be here"))
+
+(define-custom 'tutcode-postfix-mazegaki-2-start-sequence ""
+               '(tutcode-keys1)
+              '(string ".*")
+              (N_ "[TUT-Code] postfix mazegaki conversion with yomi 2")
+              (N_ "long description will be here"))
+
+(define-custom 'tutcode-postfix-mazegaki-3-start-sequence ""
+               '(tutcode-keys1)
+              '(string ".*")
+              (N_ "[TUT-Code] postfix mazegaki conversion with yomi 3")
+              (N_ "long description will be here"))
+
+(define-custom 'tutcode-postfix-mazegaki-4-start-sequence ""
+               '(tutcode-keys1)
+              '(string ".*")
+              (N_ "[TUT-Code] postfix mazegaki conversion with yomi 4")
+              (N_ "long description will be here"))
+
+(define-custom 'tutcode-postfix-mazegaki-5-start-sequence ""
+               '(tutcode-keys1)
+              '(string ".*")
+              (N_ "[TUT-Code] postfix mazegaki conversion with yomi 5")
+              (N_ "long description will be here"))
+
+(define-custom 'tutcode-postfix-mazegaki-6-start-sequence ""
+               '(tutcode-keys1)
+              '(string ".*")
+              (N_ "[TUT-Code] postfix mazegaki conversion with yomi 6")
+              (N_ "long description will be here"))
+
+(define-custom 'tutcode-postfix-mazegaki-7-start-sequence ""
+               '(tutcode-keys1)
+              '(string ".*")
+              (N_ "[TUT-Code] postfix mazegaki conversion with yomi 7")
+              (N_ "long description will be here"))
+
+(define-custom 'tutcode-postfix-mazegaki-8-start-sequence ""
+               '(tutcode-keys1)
+              '(string ".*")
+              (N_ "[TUT-Code] postfix mazegaki conversion with yomi 8")
+              (N_ "long description will be here"))
+
+(define-custom 'tutcode-postfix-mazegaki-9-start-sequence ""
+               '(tutcode-keys1)
+              '(string ".*")
+              (N_ "[TUT-Code] postfix mazegaki conversion with yomi 9")
+              (N_ "long description will be here"))
+
 (define-custom 'tutcode-latin-conv-start-sequence "al/"
                '(tutcode-keys1 mode-transition)
               '(string ".*")
@@ -196,3 +256,15 @@
               '(key)
               (N_ "[TUT-Code] purge the entry from dictionary")
               (N_ "long description will be here"))
+
+(define-custom 'tutcode-postfix-mazegaki-relimit-left-key '("<IgnoreShift><")
+              '(tutcode-keys2)
+              '(key)
+              (N_ "[TUT-Code] relimit yomi to left in postfix mazegaki")
+              (N_ "long description will be here"))
+
+(define-custom 'tutcode-postfix-mazegaki-relimit-right-key '("<IgnoreShift>>")
+              '(tutcode-keys2)
+              '(key)
+              (N_ "[TUT-Code] relimit yomi to right in postfix mazegaki")
+              (N_ "long description will be here"))
=======================================
--- /trunk/scm/tutcode.scm      Fri Jan 21 18:12:50 2011
+++ /trunk/scm/tutcode.scm      Fri Jan 28 16:03:19 2011
@@ -582,6 +582,9 @@
      (nth 0)
      ;;; ¸ò¤¼½ñ¤­ÊÑ´¹¤Î¸õÊä¿ô
      (nr-candidates 0)
+     ;;; ¸åÃÖ·¿¸ò¤¼½ñ¤­ÊÑ´¹»þ¤Ë¡¢im-acquire-text¤Ç¼èÆÀ¤·¤¿ÆÉ¤ß¤ÎŤµ
+     ;;; (³ÎÄê»þ¤Ëim-delete-text¤¹¤ë¤¿¤á¤Ë»ÈÍÑ)
+     (postfix-yomi-len 0)
      ;;; ¸õÊ䥦¥£¥ó¥É¥¦¤Î¾õÂÖ
      ;;; 'tutcode-candidate-window-off Èóɽ¼¨
      ;;; 'tutcode-candidate-window-converting ¸ò¤¼½ñ¤­ÊÑ´¹¸õÊäɽ¼¨Ãæ
@@ -1124,10 +1127,13 @@
 (define (tutcode-commit-with-auto-help pc)
   (let* ((head (tutcode-context-head pc))
          (res (tutcode-prepare-commit-string pc)))
+    (if (> (tutcode-context-postfix-yomi-len pc) 0)
+ (tutcode-postfix-delete-text pc (tutcode-context-postfix-yomi-len pc)))
     (tutcode-commit pc res)
     (tutcode-check-auto-help-window-begin pc (string-to-list res) head)))

;;; ¸ò¤¼½ñ¤­ÊÑ´¹¤Î¸õÊäÁªÂò»þ¤Ë¡¢»ØÄꤵ¤ì¤¿¥é¥Ù¥ëʸ»ú¤ËÂбþ¤¹¤ë¸õÊä¤ò³ÎÄꤹ¤ë
+;;; @param ch ÆþÎϤµ¤ì¤¿¥é¥Ù¥ëʸ»ú
 (define (tutcode-commit-by-label-key pc ch)
   ;; ¸½ºß¸õÊ䥦¥£¥ó¥É¥¦¤Ëɽ¼¨¤µ¤ì¤Æ¤¤¤Ê¤¤¥é¥Ù¥ëʸ»ú¤òÆþÎϤ·¤¿¾ì¹ç¡¢
   ;; ¸½ºß°Ê¹ß¤Î¸õÊäÆâ¤Ë¤ª¤¤¤ÆÆþÎÏ¥é¥Ù¥ëʸ»ú¤ËÂбþ¤¹¤ë¸õÊä¤ò³ÎÄꤹ¤ë¡£
@@ -1299,6 +1305,7 @@
 ;;; @param pc ¥³¥ó¥Æ¥­¥¹¥È¥ê¥¹¥È
 ;;; @param autocommit? ¸õÊ䤬1¸Ä¤Î¾ì¹ç¤Ë¼«Æ°Åª¤Ë³ÎÄꤹ¤ë¤«¤É¤¦¤«
 ;;; @param recursive-learning? ¸õÊ䤬̵¤¤¾ì¹ç¤ËºÆµ¢ÅÐÏ¿¥â¡¼¥É¤ËÆþ¤ë¤«¤É¤¦¤«
+;;; @return #t:¸õÊ䤬ͭ¤Ã¤¿¾ì¹ç¡£#f:¸õÊ䤬̵¤«¤Ã¤¿¾ì¹ç¡£
 (define (tutcode-begin-conversion pc autocommit? recursive-learning?)
   (let* ((yomi (tutcode-make-string (tutcode-context-head pc)))
          (res (and (symbol-bound? 'skk-lib-get-entry)
@@ -1317,14 +1324,43 @@
             (tutcode-check-candidate-window-begin pc)
             (if (eq? (tutcode-context-candidate-window pc)
                      'tutcode-candidate-window-converting)
-              (im-select-candidate pc 0)))))
+              (im-select-candidate pc 0))))
+        #t)
       ;; ¸õÊä̵¤·
-      (if recursive-learning?
-        (begin
-          (tutcode-context-set-state! pc 'tutcode-state-converting)
-          (tutcode-setup-child-context pc 'tutcode-child-type-editor)))
-        ;(tutcode-flush pc) ; flush¤¹¤ë¤ÈÆþÎϤ·¤¿Ê¸»úÎ󤬾䨤Ƥ¬¤Ã¤«¤ê
-        )))
+      (begin
+        (if recursive-learning?
+          (begin
+            (tutcode-context-set-state! pc 'tutcode-state-converting)
+            (tutcode-setup-child-context pc 'tutcode-child-type-editor)))
+          ;(tutcode-flush pc) ; flush¤¹¤ë¤ÈÆþÎϤ·¤¿Ê¸»úÎ󤬾䨤Ƥ¬¤Ã¤«¤ê
+        #f))))
+
+;;; ÆÉ¤ß¤ÎŤµ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¡¢
+;;; ÆÉ¤ß¤ò½Ì¤á¤Ê¤¬¤é¸åÃÖ·¿¸ò¤¼½ñ¤­ÊÑ´¹¤ò¹Ô¤¦¡£
+;;; @return #t:¸õÊ䤬ͭ¤Ã¤¿¾ì¹ç¡£#f:¸õÊ䤬̵¤«¤Ã¤¿¾ì¹ç¡£
+(define (tutcode-begin-conversion-with-relimit-right pc)
+  (let* ((head (tutcode-context-head pc))
+         (yomi (tutcode-make-string head))
+         (res (and (symbol-bound? 'skk-lib-get-entry)
+                   (skk-lib-get-entry tutcode-dic yomi "" "" #f))))
+    (if res
+      (begin
+        (tutcode-context-set-nth! pc 0)
+        (tutcode-context-set-nr-candidates! pc
+         (skk-lib-get-nr-candidates tutcode-dic yomi "" "" #f))
+        (tutcode-context-set-state! pc 'tutcode-state-converting)
+        (tutcode-check-candidate-window-begin pc)
+        (if (eq? (tutcode-context-candidate-window pc)
+                 'tutcode-candidate-window-converting)
+          (im-select-candidate pc 0))
+        #t)
+      ;; ¸õÊä̵¤·
+      (if (> (length head) 1)
+        (begin ;; ÆÉ¤ß¤ò1ʸ»ú¸º¤é¤·¤ÆºÆ¸¡º÷
+          (tutcode-context-set-head! pc (drop-right head 1))
+          (tutcode-context-set-postfix-yomi-len! pc (- (length head) 1))
+          (tutcode-begin-conversion-with-relimit-right pc))
+        #f))))

 ;;; »Ò¥³¥ó¥Æ¥­¥¹¥È¤òºîÀ®¤¹¤ë¡£
 ;;; @param type 'tutcode-child-type-editor¤«'tutcode-child-type-dialog
@@ -1501,6 +1537,16 @@
             ((tutcode-bushu-start) "¢¡")
             ((tutcode-interactive-bushu-start) "¢§")
             ((tutcode-postfix-bushu-start) "¢¥")
+            ((tutcode-postfix-mazegaki-start) "¢¤")
+            ((tutcode-postfix-mazegaki-1-start) "¢¤1")
+            ((tutcode-postfix-mazegaki-2-start) "¢¤2")
+            ((tutcode-postfix-mazegaki-3-start) "¢¤3")
+            ((tutcode-postfix-mazegaki-4-start) "¢¤4")
+            ((tutcode-postfix-mazegaki-5-start) "¢¤5")
+            ((tutcode-postfix-mazegaki-6-start) "¢¤6")
+            ((tutcode-postfix-mazegaki-7-start) "¢¤7")
+            ((tutcode-postfix-mazegaki-8-start) "¢¤8")
+            ((tutcode-postfix-mazegaki-9-start) "¢¤9")
             ((tutcode-auto-help-redisplay) "¢ã")
             (else cand)))
          (cand-hint
@@ -1843,12 +1889,13 @@
 ;;; tutcode-editor¦¤Ç¤ÎÊÔ½¸´°Î»»þ¤Ë¸Æ¤Ð¤ì¤ë¡£
 ;;; @param str ¥¨¥Ç¥£¥¿Â¦¤Ç³ÎÄꤵ¤ì¤¿Ê¸»úÎó
 (define (tutcode-commit-editor-context pc str)
-  (let ((ppc (tutcode-context-parent-context pc)))
-    (tutcode-flush pc)
-    (tutcode-context-set-child-context! pc ())
-    (tutcode-context-set-child-type! pc ())
-    (tutcode-commit pc str)
-    (tutcode-update-preedit pc)))
+  (if (> (tutcode-context-postfix-yomi-len pc) 0)
+    (tutcode-postfix-delete-text pc (tutcode-context-postfix-yomi-len pc)))
+  (tutcode-flush pc)
+  (tutcode-context-set-child-context! pc ())
+  (tutcode-context-set-child-type! pc ())
+  (tutcode-commit pc str)
+  (tutcode-update-preedit pc))

 ;;; Êä´°¸õÊä¤ò¸¡º÷¤·¤Æ¸õÊ䥦¥£¥ó¥É¥¦¤Ëɽ¼¨¤¹¤ë
 ;;; @param force-check? ɬ¤º¸¡º÷¤ò¹Ô¤¦¤«¤É¤¦¤«¡£
@@ -2159,9 +2206,11 @@
                   (tutcode-check-completion pc #f 0)))
               ((eq? res 'tutcode-mazegaki-start)
                 (tutcode-context-set-latin-conv! pc #f)
+                (tutcode-context-set-postfix-yomi-len! pc 0)
                 (tutcode-context-set-state! pc 'tutcode-state-yomi))
               ((eq? res 'tutcode-latin-conv-start)
                 (tutcode-context-set-latin-conv! pc #t)
+                (tutcode-context-set-postfix-yomi-len! pc 0)
                 (tutcode-context-set-state! pc 'tutcode-state-yomi))
               ((eq? res 'tutcode-bushu-start)
                 (tutcode-context-set-state! pc 'tutcode-state-bushu)
@@ -2172,6 +2221,35 @@
                   'tutcode-state-interactive-bushu))
               ((eq? res 'tutcode-postfix-bushu-start)
                 (tutcode-begin-postfix-bushu-conversion pc))
+              ((eq? res 'tutcode-postfix-mazegaki-start)
+                (tutcode-begin-postfix-mazegaki-conversion pc #f #f #f))
+              ((eq? res 'tutcode-postfix-mazegaki-1-start)
+                (tutcode-begin-postfix-mazegaki-conversion pc 1 #t
+                  tutcode-use-recursive-learning?))
+              ((eq? res 'tutcode-postfix-mazegaki-2-start)
+                (tutcode-begin-postfix-mazegaki-conversion pc 2 #t
+                  tutcode-use-recursive-learning?))
+              ((eq? res 'tutcode-postfix-mazegaki-3-start)
+                (tutcode-begin-postfix-mazegaki-conversion pc 3 #t
+                  tutcode-use-recursive-learning?))
+              ((eq? res 'tutcode-postfix-mazegaki-4-start)
+                (tutcode-begin-postfix-mazegaki-conversion pc 4 #t
+                  tutcode-use-recursive-learning?))
+              ((eq? res 'tutcode-postfix-mazegaki-5-start)
+                (tutcode-begin-postfix-mazegaki-conversion pc 5 #t
+                  tutcode-use-recursive-learning?))
+              ((eq? res 'tutcode-postfix-mazegaki-6-start)
+                (tutcode-begin-postfix-mazegaki-conversion pc 6 #t
+                  tutcode-use-recursive-learning?))
+              ((eq? res 'tutcode-postfix-mazegaki-7-start)
+                (tutcode-begin-postfix-mazegaki-conversion pc 7 #t
+                  tutcode-use-recursive-learning?))
+              ((eq? res 'tutcode-postfix-mazegaki-8-start)
+                (tutcode-begin-postfix-mazegaki-conversion pc 8 #t
+                  tutcode-use-recursive-learning?))
+              ((eq? res 'tutcode-postfix-mazegaki-9-start)
+                (tutcode-begin-postfix-mazegaki-conversion pc 9 #t
+                  tutcode-use-recursive-learning?))
               ((eq? res 'tutcode-auto-help-redisplay)
                 (tutcode-auto-help-redisplay pc))))))))))

@@ -2185,6 +2263,34 @@
     (tutcode-commit pc res)
     (tutcode-check-auto-help-window-begin pc (list res) ())))

+;;; ¸åÃÖ·¿¸ò¤¼½ñ¤­ÊÑ´¹¤ò¹Ô¤¦
+;;; @param yomi-len »ØÄꤵ¤ì¤¿ÆÉ¤ß¤Îʸ»ú¿ô¡£»ØÄꤵ¤ì¤Æ¤Ê¤¤¾ì¹ç¤Ï#f¡£
+;;; @param autocommit? ¸õÊ䤬1¸Ä¤Î¾ì¹ç¤Ë¼«Æ°Åª¤Ë³ÎÄꤹ¤ë¤«¤É¤¦¤«
+;;;  (yomi-len¤¬#f¤Ç¤Ê¤¤¾ì¹ç¤ËÍ­¸ú)
+;;; @param recursive-learning? ¸õÊ䤬̵¤¤¾ì¹ç¤ËºÆµ¢ÅÐÏ¿¥â¡¼¥É¤ËÆþ¤ë¤«¤É¤¦¤«
+;;;  (yomi-len¤¬#f¤Ç¤Ê¤¤¾ì¹ç¤ËÍ­¸ú)
+;;; @return #t:¸õÊ䤬ͭ¤Ã¤¿¾ì¹ç¡£#f:¸õÊ䤬̵¤«¤Ã¤¿¾ì¹ç¡£
+(define (tutcode-begin-postfix-mazegaki-conversion pc yomi-len autocommit?
+          recursive-learning?)
+  (let*
+    ((former-seq (tutcode-postfix-acquire-text pc
+                   (or yomi-len tutcode-mazegaki-yomi-max)))
+     (former-len (length former-seq)))
+    (if yomi-len
+      (if (>= former-len yomi-len)
+        (begin
+          (tutcode-context-set-head! pc (take former-seq yomi-len))
+          (tutcode-context-set-postfix-yomi-len! pc yomi-len)
+          (tutcode-begin-conversion pc autocommit? recursive-learning?))
+        #f)
+      ;; ÆÉ¤ß¤Îʸ»ú¿ô¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¢ª¼èÆÀ¤Ç¤­¤¿Ê¸»ú¤ò»ÈÍÑ(¾å¸Âyomi-max)
+      (if (> former-len 0)
+        (begin
+          (tutcode-context-set-head! pc former-seq)
+          (tutcode-context-set-postfix-yomi-len! pc former-len)
+          (tutcode-begin-conversion-with-relimit-right pc))
+        #f))))
+
 ;;; ³ÎÄêºÑʸ»úÎó¤ò¼èÆÀ¤¹¤ë
 ;;; @param len ¼èÆÀ¤¹¤ëʸ»ú¿ô
 ;;; @return ¼èÆÀ¤·¤¿Ê¸»úÎó¤Î¥ê¥¹¥È(µÕ½ç)
@@ -2774,7 +2880,10 @@
 ;;; @param pc ¥³¥ó¥Æ¥­¥¹¥È¥ê¥¹¥È
 (define (tutcode-back-to-yomi-state pc)
   (tutcode-reset-candidate-window pc)
-  (tutcode-context-set-state! pc 'tutcode-state-yomi)
+  (tutcode-context-set-state! pc
+    (if (> (tutcode-context-postfix-yomi-len pc) 0)
+      'tutcode-state-on
+      'tutcode-state-yomi))
   (tutcode-context-set-nr-candidates! pc 0))

 ;;; ¸ò¤¼½ñ¤­ÊÑ´¹¤Î¼­½ñÅÐÏ¿¾õÂÖ¤«¤é¡¢¸õÊäÁªÂò¾õÂÖ¤ËÌ᤹¡£
@@ -2807,7 +2916,9 @@
 ;;; @param key ÆþÎϤµ¤ì¤¿¥­¡¼
 ;;; @param key-state ¥³¥ó¥È¥í¡¼¥ë¥­¡¼Åù¤Î¾õÂÖ
 (define (tutcode-proc-state-converting c key key-state)
-  (let ((pc (tutcode-find-descendant-context c)))
+  (let*
+    ((pc (tutcode-find-descendant-context c))
+     (postfix-yomi-len (tutcode-context-postfix-yomi-len pc)))
     (cond
       ((tutcode-next-candidate-key? key key-state)
         (tutcode-change-candidate-index pc 1))
@@ -2819,9 +2930,8 @@
         (tutcode-change-candidate-index pc tutcode-nr-candidate-max))
       ((tutcode-prev-page-key? key key-state)
         (tutcode-change-candidate-index pc (- tutcode-nr-candidate-max)))
-      ((or
-        (tutcode-commit-key? key key-state)
-        (tutcode-return-key? key key-state))
+      ((or (tutcode-commit-key? key key-state)
+           (tutcode-return-key? key key-state))
         (tutcode-commit-with-auto-help pc))
       ((tutcode-purge-candidate-key? key key-state)
         (tutcode-reset-candidate-window pc)
@@ -2830,10 +2940,40 @@
             tutcode-use-recursive-learning?)
         (tutcode-reset-candidate-window pc)
         (tutcode-setup-child-context pc 'tutcode-child-type-editor))
+      ((and (> postfix-yomi-len 0)
+            (tutcode-postfix-mazegaki-relimit-right-key? key key-state))
+        (let ((head (tutcode-context-head pc)))
+          (if (> (length head) 1)
+            (begin ; ÆÉ¤ß¤ò½Ì¤á¤ÆºÆ¸¡º÷
+              (tutcode-reset-candidate-window pc)
+              (tutcode-context-set-head! pc (drop-right head 1))
+ (tutcode-context-set-postfix-yomi-len! pc (- (length head) 1))
+              (if (not (tutcode-begin-conversion-with-relimit-right pc))
+                (begin ; ¸õÊä̵¤·¢ªÆÉ¤ß¤ò½Ì¤á¤ë¤Î¤ÏÃæ»ß
+                  (tutcode-context-set-head! pc head)
+ (tutcode-context-set-postfix-yomi-len! pc (length head))))))))
+      ((and (> postfix-yomi-len 0)
+            (tutcode-postfix-mazegaki-relimit-left-key? key key-state))
+        (let ((head (tutcode-context-head pc)))
+          (if (< (length head) tutcode-mazegaki-yomi-max)
+            (begin ; ÆÉ¤ß¤ò¿­¤Ð¤·¤ÆºÆ¸¡º÷
+              (tutcode-reset-candidate-window pc)
+              (let loop
+                ((len (+ (length head) 1)))
+                (if (> len tutcode-mazegaki-yomi-max)
+                  (begin ; yomi-max¤Ë¤Ê¤ë¤Þ¤Ç¿­¤Ð¤·¤Æ¤â¸õÊä̵¤·¢ªÃæ»ß
+                    (tutcode-context-set-head! pc head)
+ (tutcode-context-set-postfix-yomi-len! pc (length head)))
+                  (begin
+                    (if (not (tutcode-begin-postfix-mazegaki-conversion pc
+                              len #f #f))
+ (loop (+ len 1)))))))))) ; ¸õÊä̵¤·¢ª¤µ¤é¤ËÆÉ¤ß¤ò¿­¤Ð¤¹
       ((and tutcode-commit-candidate-by-label-key?
             (tutcode-heading-label-char? key))
         (tutcode-commit-by-label-key pc (charcode->string key)))
       (else
+        (if (> postfix-yomi-len 0)
+          (tutcode-postfix-delete-text pc postfix-yomi-len))
         (tutcode-commit pc (tutcode-prepare-commit-string pc))
         (tutcode-proc-state-on pc key key-state)))))

@@ -3241,8 +3381,11 @@
         (case (tutcode-context-state pc)
           ((tutcode-state-on)
            (tutcode-proc-state-on pc key key-state)
-           (if (tutcode-state-has-preedit? c)
-             ;; ¸ò¤¼½ñ¤­ÊÑ´¹¤äÉô¼ó¹çÀ®ÊÑ´¹³«»Ï¡£¢¤¤ä¢¥¤òɽ¼¨¤¹¤ë
+           (if (or
+                 ;; ¸ò¤¼½ñ¤­ÊÑ´¹¤äÉô¼ó¹çÀ®ÊÑ´¹³«»Ï¡£¢¤¤ä¢¥¤òɽ¼¨¤¹¤ë
+                 (tutcode-state-has-preedit? c)
+                 ;; ʸ»ú¿ô»ØÄê¸åÃÖ·¿¸ò¤¼½ñ¤­ÊÑ´¹¤ÎºÆµ¢³Ø½¬¥­¥ã¥ó¥»¥ë
+                 (not (eq? (tutcode-find-descendant-context c) pc)))
              (tutcode-update-preedit pc)))
           ((tutcode-state-kigou)
            (tutcode-proc-state-kigou pc key key-state)
@@ -3732,6 +3875,26 @@
               '(tutcode-interactive-bushu-start)))
           (make-subrule tutcode-postfix-bushu-start-sequence
             '(tutcode-postfix-bushu-start))
+          (make-subrule tutcode-postfix-mazegaki-start-sequence
+            '(tutcode-postfix-mazegaki-start))
+          (make-subrule tutcode-postfix-mazegaki-1-start-sequence
+            '(tutcode-postfix-mazegaki-1-start))
+          (make-subrule tutcode-postfix-mazegaki-2-start-sequence
+            '(tutcode-postfix-mazegaki-2-start))
+          (make-subrule tutcode-postfix-mazegaki-3-start-sequence
+            '(tutcode-postfix-mazegaki-3-start))
+          (make-subrule tutcode-postfix-mazegaki-4-start-sequence
+            '(tutcode-postfix-mazegaki-4-start))
+          (make-subrule tutcode-postfix-mazegaki-5-start-sequence
+            '(tutcode-postfix-mazegaki-5-start))
+          (make-subrule tutcode-postfix-mazegaki-6-start-sequence
+            '(tutcode-postfix-mazegaki-6-start))
+          (make-subrule tutcode-postfix-mazegaki-7-start-sequence
+            '(tutcode-postfix-mazegaki-7-start))
+          (make-subrule tutcode-postfix-mazegaki-8-start-sequence
+            '(tutcode-postfix-mazegaki-8-start))
+          (make-subrule tutcode-postfix-mazegaki-9-start-sequence
+            '(tutcode-postfix-mazegaki-9-start))
           (make-subrule tutcode-auto-help-redisplay-sequence
             '(tutcode-auto-help-redisplay)))))))

Reply via email to