Author: iratqq
Date: Mon Mar 2 18:43:23 2009
New Revision: 5883
Modified:
trunk/scm/yahoo-jp-custom.scm
trunk/scm/yahoo-jp.scm
Log:
* scm/yahoo-jp.scm
* scm/yahoo-jp-custom.scm
- Sync with r5872.
Modified: trunk/scm/yahoo-jp-custom.scm
==============================================================================
--- trunk/scm/yahoo-jp-custom.scm (original)
+++ trunk/scm/yahoo-jp-custom.scm Mon Mar 2 18:43:23 2009
@@ -381,3 +381,40 @@
'(integer 1 65535)
(N_ "Number of cache of prediction candidates")
(N_ "long description will be here."))
+
+(define-custom 'yahoo-jp-prediction-start-char-count 2
+ '(yahoo-jp-advanced yahoo-jp-prediction)
+ '(integer 1 65535)
+ (N_ "Character count to start input prediction")
+ (N_ "long description will be here."))
+
+(custom-add-hook 'yahoo-jp-use-candidate-window?
+ 'custom-get-hooks
+ (lambda ()
+ (if (not yahoo-jp-use-candidate-window?)
+ (set! yahoo-jp-use-prediction? #f))))
+
+(custom-add-hook 'yahoo-jp-use-prediction?
+ 'custom-activity-hooks
+ (lambda ()
+ yahoo-jp-use-candidate-window?))
+
+(custom-add-hook 'yahoo-jp-select-prediction-by-numeral-key?
+ 'custom-activity-hooks
+ (lambda ()
+ yahoo-jp-use-prediction?))
+
+(custom-add-hook 'yahoo-jp-use-implicit-commit-prediction?
+ 'custom-activity-hooks
+ (lambda ()
+ yahoo-jp-use-prediction?))
+
+(custom-add-hook 'yahoo-jp-prediction-cache-words
+ 'custom-activity-hooks
+ (lambda ()
+ yahoo-jp-use-prediction?))
+
+(custom-add-hook 'yahoo-jp-prediction-start-char-count
+ 'custom-activity-hooks
+ (lambda ()
+ yahoo-jp-use-prediction?))
Modified: trunk/scm/yahoo-jp.scm
==============================================================================
--- trunk/scm/yahoo-jp.scm (original)
+++ trunk/scm/yahoo-jp.scm Mon Mar 2 18:43:23 2009
@@ -1094,7 +1094,7 @@
(not (shift-key-mask key-state))))
;; go back to unselected prediction
(yahoo-jp-reset-prediction-window yc)
- (yahoo-jp-check-prediction yc))
+ (yahoo-jp-check-prediction yc #f))
((and
(ichar-numeric? key)
yahoo-jp-select-prediction-by-numeral-key?
@@ -1122,6 +1122,10 @@
((yahoo-jp-begin-conv-key? key key-state)
(yahoo-jp-begin-conv yc))
+ ;; prediction
+ ((yahoo-jp-next-prediction-key? key key-state)
+ (yahoo-jp-check-prediction yc #t))
+
;; backspace
((yahoo-jp-backspace-key? key key-state)
(if (not (rk-backspace rkc))
@@ -1347,34 +1351,47 @@
(yahoo-jp-context-set-prediction-window! yc #f)
(yahoo-jp-context-set-prediction-index! yc #f))
-(define (yahoo-jp-check-prediction yc)
+(define (yahoo-jp-check-prediction yc force-check?)
(if (and
(not (yahoo-jp-context-state yc))
(not (yahoo-jp-context-transposing yc))
(not (yahoo-jp-context-predicting yc)))
- (let ((preconv-str
- (yahoo-jp-make-whole-string yc #t (yahoo-jp-context-kana-mode
yc))))
- (if (not (string=? preconv-str ""))
- (begin
- (yahoo-jp-lib-set-prediction-src-string yc preconv-str)
- (let ((nr (yahoo-jp-lib-get-nr-predictions yc)))
- (if (and
- nr
- (> nr 0))
- (begin
+ (let* ((use-pending-rk-for-prediction? #t)
+ (preconv-str
+ (yahoo-jp-make-whole-string
+ yc
+ (not use-pending-rk-for-prediction?)
+ (yahoo-jp-context-kana-mode yc)))
+ (preedit-len (+
+ (ustr-length (yahoo-jp-context-preconv-ustr yc))
+ (if (not use-pending-rk-for-prediction?)
+ 0
+ (string-length (rk-pending
+ (yahoo-jp-context-rkc
+ yc)))))))
+ (if (or
+ (>= preedit-len yahoo-jp-prediction-start-char-count)
+ force-check?)
+ (begin
+ (yahoo-jp-lib-set-prediction-src-string yc preconv-str)
+ (let ((nr (yahoo-jp-lib-get-nr-predictions yc)))
+ (if (and
+ nr
+ (> nr 0))
+ (begin
(im-activate-candidate-selector
yc nr yahoo-jp-nr-candidate-max)
(yahoo-jp-context-set-prediction-window! yc #t)
(yahoo-jp-context-set-predicting! yc #t))
- (yahoo-jp-reset-prediction-window yc))))
- (yahoo-jp-reset-prediction-window yc)))))
+ (yahoo-jp-reset-prediction-window yc))))
+ (yahoo-jp-reset-prediction-window yc)))))
(define (yahoo-jp-proc-input-state yc key key-state)
(if (yahoo-jp-has-preedit? yc)
(yahoo-jp-proc-input-state-with-preedit yc key key-state)
(yahoo-jp-proc-input-state-no-preedit yc key key-state))
(if yahoo-jp-use-prediction?
- (yahoo-jp-check-prediction yc)))
+ (yahoo-jp-check-prediction yc #f)))
(define yahoo-jp-separator
(lambda (yc)