Revision: 7334
Author: deton.kih
Date: Sat Oct 22 19:03:16 2011
Log: * scm/tutcode.scm
- (tutcode-commit-by-label-key-for-prediction,
tutcode-set-candidate-index-handler):
Change not to set index without kanji combination guide
to prediction-index to avoid confusion.
- (tutcode-get-prediction-string): Add idx argument.
- (tutcode-learn-prediction-string):
Change to use idx argument instead of prediction-index context.
- (tutcode-do-commit-prediction,
tutcode-do-commit-prediction-for-bushu,
tutcode-do-commit-prediction-for-interactive-bushu):
Change to use idx argument.
- (tutcode-do-update-preedit,
tutcode-proc-state-interactive-bushu):
Follow the argument change of tutcode-get-prediction-string.
http://code.google.com/p/uim/source/detail?r=7334
Modified:
/trunk/scm/tutcode.scm
=======================================
--- /trunk/scm/tutcode.scm Sat Oct 22 18:47:23 2011
+++ /trunk/scm/tutcode.scm Sat Oct 22 19:03:16 2011
@@ -1411,48 +1411,41 @@
(nr (tutcode-lib-get-nr-predictions pc))
(i (remainder idx nr)))
(if (>= i 0)
- (begin
- (tutcode-context-set-prediction-index! pc i)
- (case mode
- ((tutcode-predicting-bushu)
- (tutcode-do-commit-prediction-for-bushu pc))
- ((tutcode-predicting-interactive-bushu)
- (tutcode-do-commit-prediction-for-interactive-bushu pc))
- ((tutcode-predicting-completion)
- (tutcode-do-commit-prediction pc #t))
- (else
- (tutcode-do-commit-prediction pc #f)))))))
-
-(define (tutcode-get-prediction-string pc)
- (tutcode-lib-get-nth-prediction
- pc
- (tutcode-context-prediction-index pc)))
-
-(define (tutcode-learn-prediction-string pc completion?)
- (tutcode-lib-commit-nth-prediction
- pc
- (tutcode-context-prediction-index pc)
- completion?))
+ (case mode
+ ((tutcode-predicting-bushu)
+ (tutcode-do-commit-prediction-for-bushu pc i))
+ ((tutcode-predicting-interactive-bushu)
+ (tutcode-do-commit-prediction-for-interactive-bushu pc i))
+ ((tutcode-predicting-completion)
+ (tutcode-do-commit-prediction pc i #t))
+ (else
+ (tutcode-do-commit-prediction pc i #f))))))
+
+(define (tutcode-get-prediction-string pc idx)
+ (tutcode-lib-get-nth-prediction pc idx))
+
+(define (tutcode-learn-prediction-string pc idx completion?)
+ (tutcode-lib-commit-nth-prediction pc idx completion?))
;;; Êä´°/ͽ¬ÆþÎϸõÊä¤ò³ÎÄꤹ¤ë
;;; @param completion? Êä´°¤«¤É¤¦¤«
-(define (tutcode-do-commit-prediction pc completion?)
- (let ((str (tutcode-get-prediction-string pc)))
- (tutcode-learn-prediction-string pc completion?)
+(define (tutcode-do-commit-prediction pc idx completion?)
+ (let ((str (tutcode-get-prediction-string pc idx)))
+ (tutcode-learn-prediction-string pc idx completion?)
(tutcode-reset-candidate-window pc)
(tutcode-commit pc str)
(tutcode-flush pc)
(tutcode-check-auto-help-window-begin pc (string-to-list str) ())))
;;; Éô¼ó¹çÀ®ÊÑ´¹»þ¤Îͽ¬ÆþÎϸõÊä¤ò³ÎÄꤹ¤ë
-(define (tutcode-do-commit-prediction-for-bushu pc)
- (let ((str (tutcode-get-prediction-string pc)))
+(define (tutcode-do-commit-prediction-for-bushu pc idx)
+ (let ((str (tutcode-get-prediction-string pc idx)))
(tutcode-reset-candidate-window pc)
(tutcode-bushu-commit pc str)))
;;; ÂÐÏÃŪÉô¼ó¹çÀ®ÊÑ´¹»þ¤Î¸õÊä¤ò³ÎÄꤹ¤ë
-(define (tutcode-do-commit-prediction-for-interactive-bushu pc)
- (let ((str (tutcode-get-prediction-string pc)))
+(define (tutcode-do-commit-prediction-for-interactive-bushu pc idx)
+ (let ((str (tutcode-get-prediction-string pc idx)))
(tutcode-reset-candidate-window pc)
(tutcode-commit pc str)
(tutcode-flush pc)
@@ -2292,7 +2285,8 @@
(begin
(im-pushback-preedit pc preedit-underline "=>")
(im-pushback-preedit pc preedit-underline
- (tutcode-get-prediction-string pc)))))
+ (tutcode-get-prediction-string pc
+ (tutcode-context-prediction-index pc)))))) ; ½Ï¸ì¥¬¥¤¥É̵¤·
((tutcode-state-kigou)
;; ¸õÊ䥦¥£¥ó¥É¥¦Èóɽ¼¨»þ¤Ç¤â¸õÊäÁªÂò¤Ç¤¤ë¤è¤¦¤Ëpreeditɽ¼¨
(im-pushback-preedit pc preedit-reverse
@@ -3694,7 +3688,8 @@
(let ((str
(cond
(has-candidate?
- (tutcode-get-prediction-string pc))
+ (tutcode-get-prediction-string pc
+ (tutcode-context-prediction-index pc))) ;
½Ï¸ì¥¬¥¤¥É̵
((> (length head) 0)
(string-list-concat (tutcode-context-head pc)))
(else
@@ -4798,12 +4793,11 @@
(p-idx (+ idx-in-page (* pages nr-in-page)))
(i (remainder p-idx nr-predictions))
(mode (tutcode-context-predicting pc)))
- (tutcode-context-set-prediction-index! pc i)
(if (eq? candwin 'tutcode-candidate-window-interactive-bushu)
- (tutcode-do-commit-prediction-for-interactive-bushu pc)
+ (tutcode-do-commit-prediction-for-interactive-bushu pc i)
(if (eq? mode 'tutcode-predicting-bushu)
- (tutcode-do-commit-prediction-for-bushu pc)
- (tutcode-do-commit-prediction pc
+ (tutcode-do-commit-prediction-for-bushu pc i)
+ (tutcode-do-commit-prediction pc i
(eq? mode 'tutcode-predicting-completion))))
(tutcode-update-preedit pc))))))))