Revision: 6975
Author: deton.kih
Date: Wed Feb 23 02:48:52 2011
Log: * Change to be able to customize to do completion/prediction only when
  tutcode-begin-completion-key is typed.
* scm/tutcode-custom.scm
  - (tutcode-completion-chars-min,
     tutcode-prediction-start-char-count): Change lower limit to 0.
* scm/tutcode.scm
  - Update comment.
  - (tutcode-check-completion):
    Move call of tutcode-make-string after decision to do completion
    for performance.
  - (tutcode-check-prediction): Ditto.
  - (tutcode-proc-state-on):
    Change not to call tutcode-check-completion
    when tutcode-completion-chars-min is 0
    and tutcode-begin-completion-key is not typed.
  - (tutcode-proc-state-yomi): Ditto.

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

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

=======================================
--- /trunk/scm/tutcode-custom.scm       Wed Feb 23 02:46:56 2011
+++ /trunk/scm/tutcode-custom.scm       Wed Feb 23 02:48:52 2011
@@ -236,7 +236,7 @@

 (define-custom 'tutcode-completion-chars-min 2
   '(tutcode tutcode-prediction)
-  '(integer 1 65535)
+  '(integer 0 65535)
   (N_ "Minimum character length for completion")
   (N_ "long description will be here."))

@@ -254,7 +254,7 @@

 (define-custom 'tutcode-prediction-start-char-count 2
   '(tutcode tutcode-prediction)
-  '(integer 1 65535)
+  '(integer 0 65535)
   (N_ "Character count to start input prediction")
   (N_ "long description will be here."))

=======================================
--- /trunk/scm/tutcode.scm      Wed Feb 23 02:46:56 2011
+++ /trunk/scm/tutcode.scm      Wed Feb 23 02:48:52 2011
@@ -171,6 +171,9 @@
 ;;; ** ͽ¬ÆþÎÏ: ¸ò¤¼½ñ¤­ÊÑ´¹¤ÎÆÉ¤ßÆþÎϾõÂÖ¤Ç<Control>.ÂǸ°»þ
;;; * Êä´°¸õÊäɽ¼¨¤Ë¤µ¤é¤Ë<Control>.¤òÂǸ°¤¹¤ë¤ÈÂоÝʸ»ú¤ò1¤Ä¸º¤é¤·¤ÆºÆÊä´°¡£
 ;;;   Ť¹¤®¤ëʸ»úÎó¤òÂоݤËÊä´°¤µ¤ì¤¿¾ì¹ç¤Ë¡¢Êä´°¤·Ä¾¤·¤¬¤Ç¤­¤ë¤è¤¦¤Ë¡£
+;;; * ¾åµ­¤ÎÊä´°³«»Ïʸ»ú¿ô(tutcode-completion-chars-min)¤ä
+;;;   ͽ¬³«»Ïʸ»ú¿ô(tutcode-prediction-start-char-count)¤ò0¤ËÀßÄꤹ¤ë¤È¡¢
+;;;   <Control>.ÂǸ°»þ¤Ë¤Î¤ßÊä´°/ͽ¬ÆþÎϸõÊä¤òɽ¼¨¤·¤Þ¤¹¡£
 ;;; * ½Ï¸ì¥¬¥¤¥É(¼¡¤ËÆþÎϤ¬Í½Â¬¤µ¤ì¤ëʸ»ú¤ÎÂǸ°¥¬¥¤¥É)¤Ï
 ;;;   Êä´°/ͽ¬ÆþÎϸõÊ䤫¤éºî¤Ã¤Æ¤¤¤Þ¤¹¡£
 ;;; * ½Ï¸ì¥¬¥¤¥É¤Çɽ¼¨¤µ¤ì¤Æ¤¤¤ë+ÉÕ¤­Ê¸»ú¤ËÂбþ¤¹¤ë¥­¡¼¤òÆþÎϤ·¤¿¾ì¹ç¡¢
@@ -2012,13 +2015,12 @@
             (if (> num 0)
               (take commit-strs-all num)
               commit-strs-all))
-           (str (tutcode-make-string commit-strs))
            (len (length commit-strs)))
       (if
         (or (>= len tutcode-completion-chars-min)
             (and force-check?
                  (> len 0)))
-        (begin
+        (let ((str (tutcode-make-string commit-strs)))
           (tutcode-lib-set-prediction-src-string pc str #t)
           (let ((nr (tutcode-lib-get-nr-predictions pc)))
             (if (and nr (> nr 0))
@@ -2059,13 +2061,13 @@
 (define (tutcode-check-prediction pc force-check?)
   (if (eq? (tutcode-context-predicting pc) 'tutcode-predicting-off)
     (let* ((head (tutcode-context-head pc))
-           (preconv-str (tutcode-make-string head))
            (preedit-len (length head)))
       (if
         (or (>= preedit-len tutcode-prediction-start-char-count)
             force-check?)
         (let*
- ((all-yomi (tutcode-lib-set-prediction-src-string pc preconv-str #f))
+          ((preconv-str (tutcode-make-string head))
+ (all-yomi (tutcode-lib-set-prediction-src-string pc preconv-str #f))
            (nr (tutcode-lib-get-nr-predictions pc)))
           (if (and nr (> nr 0))
             (let*
@@ -2266,7 +2268,7 @@
                    (if (> (length (tutcode-context-commit-strs pc)) 0)
                      (tutcode-context-set-commit-strs! pc
                        (cdr (tutcode-context-commit-strs pc))))
-                   (if completing?
+                   (if (and completing? (> tutcode-completion-chars-min 0))
                      (tutcode-check-completion pc #f 0)))))))
           ((tutcode-stroke-help-toggle-key? key key-state)
            (tutcode-toggle-stroke-help pc))
@@ -2305,7 +2307,8 @@
             (cond
               ((string? res)
                 (tutcode-commit pc res)
-                (if tutcode-use-completion?
+                (if (and tutcode-use-completion?
+                         (> tutcode-completion-chars-min 0))
                   (tutcode-check-completion pc #f 0)))
               ((eq? res 'tutcode-mazegaki-start)
                 (tutcode-context-set-latin-conv! pc #f)
@@ -2826,7 +2829,7 @@
             (if (> (length head) 0)
               (begin
                 (tutcode-context-set-head! pc (cdr head))
-                (if predicting?
+ (if (and predicting? (> tutcode-prediction-start-char-count 0))
                   (tutcode-check-prediction pc #f))))))
           ((or
             (tutcode-commit-key? key key-state)
@@ -2937,6 +2940,7 @@
           (begin
             (tutcode-append-string pc res)
             (if (and tutcode-use-prediction?
+                     (> tutcode-prediction-start-char-count 0)
;; ¸åÃÖ·¿Éô¼ó¹çÀ®ÊÑ´¹¤Ë¤è¤ëauto-helpɽ¼¨ºÑ»þ¤Ï²¿¤â¤·¤Ê¤¤
                      (eq? (tutcode-context-candidate-window pc)
                           'tutcode-candidate-window-off))

Reply via email to