diff -ru uim-1.0.1.orig/scm/anthy.scm uim-1.0.1/scm/anthy.scm --- uim-1.0.1.orig/scm/anthy.scm 2005-12-07 21:39:30.000000000 +0900 +++ uim-1.0.1/scm/anthy.scm 2006-04-06 10:47:12.000000000 +0900 @@ -485,36 +485,58 @@ (define anthy-proc-transposing-state (lambda (ac key key-state) - (cond - ((anthy-transpose-as-hiragana-key? key key-state) - (anthy-context-set-transposing-type! ac anthy-type-hiragana)) + (let (toggle-list state) + (if (anthy-transpose-as-wide-latin-key? key key-state) + (set! toggle-list (cons anthy-type-wide-latin toggle-list))) + (if (anthy-transpose-as-latin-key? key key-state) + (set! toggle-list (cons anthy-type-latin toggle-list))) + (if (anthy-transpose-as-hankana-key? key key-state) + (set! toggle-list (cons anthy-type-hankana toggle-list))) + (if (anthy-transpose-as-katakana-key? key key-state) + (set! toggle-list (cons anthy-type-katakana toggle-list))) + (if (anthy-transpose-as-hiragana-key? key key-state) + (set! toggle-list (cons anthy-type-hiragana toggle-list))) + + (if (anthy-context-transposing ac) + (or (set! state + (car (cdr (member + (anthy-context-transposing-type ac) + toggle-list)))) + (set! state (car toggle-list))) + (begin + (anthy-context-set-transposing! ac #t) + (set! state (car toggle-list)))) - ((anthy-transpose-as-katakana-key? key key-state) - (anthy-context-set-transposing-type! ac anthy-type-katakana)) + (cond + ((= state anthy-type-hiragana) + (anthy-context-set-transposing-type! ac anthy-type-hiragana)) - ((anthy-transpose-as-hankana-key? key key-state) - (anthy-context-set-transposing-type! ac anthy-type-hankana)) + ((= state anthy-type-katakana) + (anthy-context-set-transposing-type! ac anthy-type-katakana)) - ((anthy-transpose-as-latin-key? key key-state) - (if (not (= (anthy-context-input-rule ac) - anthy-input-rule-kana)) - (anthy-context-set-transposing-type! ac anthy-type-latin))) - - ((anthy-transpose-as-wide-latin-key? key key-state) - (if (not (= (anthy-context-input-rule ac) - anthy-input-rule-kana)) - (anthy-context-set-transposing-type! ac anthy-type-wide-latin))) + ((= state anthy-type-hankana) + (anthy-context-set-transposing-type! ac anthy-type-hankana)) - (else - (begin - ; commit - (im-commit ac (anthy-transposing-text ac)) - (anthy-flush ac) - (if (not (anthy-commit-key? key key-state)) - (begin - (anthy-context-set-transposing! ac #f) - (anthy-proc-input-state ac key key-state) - (anthy-context-set-commit-raw! ac #f)))))))) + ((= state anthy-type-latin) + (if (not (= (anthy-context-input-rule ac) + anthy-input-rule-kana)) + (anthy-context-set-transposing-type! ac anthy-type-latin))) + + ((= state anthy-type-wide-latin) + (if (not (= (anthy-context-input-rule ac) + anthy-input-rule-kana)) + (anthy-context-set-transposing-type! ac anthy-type-wide-latin))) + + (else + (begin + ; commit + (im-commit ac (anthy-transposing-text ac)) + (anthy-flush ac) + (if (not (anthy-commit-key? key key-state)) + (begin + (anthy-context-set-transposing! ac #f) + (anthy-proc-input-state ac key key-state) + (anthy-context-set-commit-raw! ac #f))))))))) (define anthy-proc-input-state-with-preedit (lambda (ac key key-state) @@ -567,9 +589,7 @@ (anthy-transpose-as-hankana-key? key key-state) (anthy-transpose-as-latin-key? key key-state) (anthy-transpose-as-wide-latin-key? key key-state)) - (begin - (anthy-context-set-transposing! ac #t) - (anthy-proc-transposing-state ac key key-state))) + (anthy-proc-transposing-state ac key key-state)) ;; Commit current preedit string, then toggle hiragana/katakana mode. ((anthy-kana-toggle-key? key key-state) @@ -905,6 +925,15 @@ ((anthy-prev-candidate-key? key key-state) (anthy-move-candidate ac -1)) + ((or (anthy-transpose-as-hiragana-key? key key-state) + (anthy-transpose-as-katakana-key? key key-state) + (anthy-transpose-as-hankana-key? key key-state) + (anthy-transpose-as-latin-key? key key-state) + (anthy-transpose-as-wide-latin-key? key key-state)) + (begin + (anthy-cancel-conv ac) + (anthy-proc-transposing-state ac key key-state))) + ((anthy-cancel-key? key key-state) (anthy-cancel-conv ac)) diff -ru uim-1.0.1.orig/scm/canna.scm uim-1.0.1/scm/canna.scm --- uim-1.0.1.orig/scm/canna.scm 2005-12-16 17:09:46.000000000 +0900 +++ uim-1.0.1/scm/canna.scm 2006-04-06 12:01:34.000000000 +0900 @@ -391,23 +391,41 @@ (define canna-proc-transposing-state (lambda (cc key key-state) - (cond - ((canna-transpose-as-hiragana-key? key key-state) - (canna-context-set-transposing-type! cc multi-segment-type-hiragana)) + (let (toggle-list state) + (if (canna-transpose-as-hankana-key? key key-state) + (set! toggle-list (cons multi-segment-type-hankana toggle-list))) + (if (canna-transpose-as-katakana-key? key key-state) + (set! toggle-list (cons multi-segment-type-katakana toggle-list))) + (if (canna-transpose-as-hiragana-key? key key-state) + (set! toggle-list (cons multi-segment-type-hiragana toggle-list))) + + (if (canna-context-transposing cc) + (or (set! state + (car (cdr (member + (canna-context-transposing-type cc) + toggle-list)))) + (set! state (car toggle-list))) + (begin + (canna-context-set-transposing! cc #t) + (set! state (car toggle-list)))) + + (cond + ((= state multi-segment-type-hiragana) + (canna-context-set-transposing-type! cc multi-segment-type-hiragana)) - ((canna-transpose-as-katakana-key? key key-state) - (canna-context-set-transposing-type! cc multi-segment-type-katakana)) + ((= state multi-segment-type-katakana) + (canna-context-set-transposing-type! cc multi-segment-type-katakana)) - ((canna-transpose-as-hankana-key? key key-state) - (canna-context-set-transposing-type! cc multi-segment-type-hankana)) + ((= state multi-segment-type-hankana) + (canna-context-set-transposing-type! cc multi-segment-type-hankana)) - (else - (begin - ; commit - (im-commit cc (canna-transposing-text cc)) - (canna-flush cc) - (if (not (canna-commit-key? key key-state)) - (canna-proc-input-state cc key key-state))))))) + (else + (begin + ; commit + (im-commit cc (canna-transposing-text cc)) + (canna-flush cc) + (if (not (canna-commit-key? key key-state)) + (canna-proc-input-state cc key key-state)))))))) (define (canna-proc-input-state-with-preedit cc key key-state) (let* ((rkc (canna-context-rkc cc)) @@ -469,7 +487,6 @@ (canna-transpose-as-hankana-key? key key-state)) (begin (canna-context-confirm-kana! cc) - (canna-context-set-transposing! cc #t) (canna-proc-transposing-state cc key key-state))) ;; 現在のかなを確定後、ひらがな/カタカナモードを切り換える @@ -828,6 +845,15 @@ ((canna-prev-candidate-key? key key-state) (canna-move-candidate cc -1)) + ((or (canna-transpose-as-hiragana-key? key key-state) + (canna-transpose-as-katakana-key? key key-state) + (canna-transpose-as-hankana-key? key key-state)) + (begin + (canna-context-set-state! cc #f) + (canna-reset-candidate-window cc) + (canna-lib-reset-conversion cc-id) + (canna-proc-transposing-state cc key key-state))) + ((canna-cancel-key? key key-state) (begin (canna-context-set-state! cc #f)