diff -upr uim-15f0788.org/scm/anthy-utf8.scm uim-15f0788/scm/anthy-utf8.scm --- uim-15f0788.org/scm/anthy-utf8.scm 2022-09-27 12:14:09.000000000 +0900 +++ uim-15f0788/scm/anthy-utf8.scm 2023-04-08 07:39:15.337073000 +0900 @@ -42,6 +42,11 @@ ;;; implementations +;; hello_lv1氏 - はじめから - 2014-05-09 - uim-anthyの無変換キーの使い勝手を修正 +;; http://d.hatena.ne.jp/hello_lv1/20140509 +(define my-state 0) +(define my-check 0) + (define anthy-utf8-lib-initialized? #f) (define anthy-version #f) @@ -58,6 +63,7 @@ (define anthy-input-rule-act 3) (define anthy-input-rule-kzik 4) +(define anthy-candidate-type-unconverted -1) ;; Patched by G-HAL, Wed,22 Apr,2009 (define anthy-candidate-type-katakana -2) (define anthy-candidate-type-hiragana -3) (define anthy-candidate-type-halfkana -4) @@ -558,6 +564,7 @@ (anthy-utf8-context-set-on! ac #t) (rk-flush (anthy-utf8-context-rkc ac)) (anthy-utf8-context-set-converting! ac #f) + (anthy-utf8-reset-commit-transposing-text ac) ;; Patched by G-HAL, Tue,28 Apr,2009 #t) #f))) @@ -575,7 +582,7 @@ ()))) (context-update-preedit ac segments)) (anthy-utf8-context-set-commit-raw! ac #f)))) - + (define anthy-utf8-proc-raw-state (lambda (ac key key-state) (if (not (anthy-utf8-begin-input ac key key-state)) @@ -600,7 +607,7 @@ )))))) (define anthy-utf8-cancel-conv - (lambda (ac) + (lambda (ac) (set! my-state 0)(set! my-check 0) (anthy-utf8-reset-candidate-window ac) (anthy-utf8-context-set-converting! ac #f) (ustr-clear! (anthy-utf8-context-segments ac)))) @@ -651,11 +658,13 @@ (anthy-utf8-context-set-on! ac #f)) ((anthy-backspace-key? key key-state) - (anthy-utf8-commit-raw ac)) + (anthy-utf8-commit-raw ac) + (anthy-utf8-forget-commit-transposing-text ac) ;; Patched by G-HAL, Wed,29 Apr,2009, Tue,14 Jul,2009 + ) ((anthy-delete-key? key key-state) (anthy-utf8-commit-raw ac)) - + ((and (anthy-hiragana-key? key key-state) (not @@ -712,11 +721,15 @@ ;; modifiers (except shift) => ignore ((and (modifier-key-mask key-state) (not (shift-key-mask key-state))) - (anthy-utf8-commit-raw ac)) - + (anthy-utf8-commit-raw ac) + (anthy-utf8-reset-commit-transposing-text ac) ;; Patched by G-HAL, Mon,20 Jul,2009 + ) + ;; direct key => commit (direct - (im-commit ac (anthy-utf8-lib-eucjp-to-utf8 direct))) + (im-commit ac (anthy-utf8-lib-eucjp-to-utf8 direct)) + (anthy-utf8-reset-commit-transposing-text ac) ;; Patched by G-HAL, Tue,14 Jul,2009 + ) ;; space key => commit ((anthy-space-key? key key-state) @@ -727,8 +740,28 @@ anthy-type-halfwidth-alnum)))) (im-commit ac (anthy-utf8-lib-eucjp-to-utf8 (list-ref ja-space (anthy-utf8-context-kana-mode ac)))))) + ;; Patched by G-HAL, Wed,29 Apr,2009 + ((generic-go-up-key? key key-state) + (anthy-utf8-commit-raw ac) + (anthy-utf8-reset-commit-transposing-text ac) + ) + ((generic-go-down-key? key key-state) + (anthy-utf8-commit-raw ac) + (anthy-utf8-reset-commit-transposing-text ac) + ) + ((generic-go-left-key? key key-state) + (anthy-utf8-commit-raw ac) + (anthy-utf8-reset-commit-transposing-text ac) + ) + ((generic-go-right-key? key key-state) + (anthy-utf8-commit-raw ac) + (anthy-utf8-reset-commit-transposing-text ac) + ) + ((anthy-non-composing-symbol? ac key) - (anthy-utf8-commit-raw ac)) + (anthy-utf8-commit-raw ac) + (anthy-utf8-reset-commit-transposing-text ac) ;; Patched by G-HAL, Tue,14 Jul,2009 + ) (else (if (anthy-utf8-context-alnum ac) @@ -750,7 +783,7 @@ (charcode->string key)) (if (symbol? key) (symbol->string key) - (charcode->string (ichar-downcase key))))) + (charcode->string key)))) (res (rk-push-key! rkc key-str))) (if res (begin @@ -810,10 +843,60 @@ (expand-segment) (anthy-utf8-lib-commit-segment ac-id 0 type)))))) +;; Patched by G-HAL, Wed,29 Apr,2009 +(define anthy-utf8-commit-transposing-text + (lambda (ac) + (let ((ac-id (anthy-utf8-context-ac-id ac)) + (transposing-type (anthy-utf8-context-transposing-type ac)) + (preconv-str (anthy-utf8-make-whole-string ac #t anthy-type-hiragana)) + (type #f)) + (cond + ((= transposing-type anthy-type-hiragana) + (set! type anthy-candidate-type-hiragana)) + ((= transposing-type anthy-type-katakana) + (set! type anthy-candidate-type-katakana)) + ((= transposing-type anthy-type-halfkana) + (set! type anthy-candidate-type-halfkana))) + (if (and ac-id + (> (string-length preconv-str) 0) + type) + (begin + (anthy-utf8-lib-set-string ac-id (anthy-utf8-lib-eucjp-to-utf8 preconv-str)) + (anthy-utf8-lib-commit-segment ac-id -1 type)))))) + +;; Patched by G-HAL, Wed,22 Apr,2009, Wed,29 Apr,2009 +(define anthy-utf8-commit-unconverted-transposing-text + (lambda (ac) + (let ((ac-id (anthy-utf8-context-ac-id ac)) + (preconv-str (anthy-utf8-make-whole-string ac #t anthy-type-hiragana))) + (if (and ac-id + (> (string-length preconv-str) 0)) + (begin + (anthy-utf8-lib-set-string ac-id (anthy-utf8-lib-eucjp-to-utf8 preconv-str)) + (anthy-utf8-lib-commit-segment ac-id -1 anthy-candidate-type-unconverted)))))) + +;; Patched by G-HAL, Sat,25 Apr,2009 +(define anthy-utf8-reset-commit-transposing-text + (lambda (ac) + (let ((ac-id (anthy-utf8-context-ac-id ac))) + (begin + (anthy-utf8-lib-commit-segment ac-id -1 -128))))) + +;; Patched by G-HAL, Tue,14 Jul,2009 +(define anthy-utf8-forget-commit-transposing-text + (lambda (ac) + (let ((ac-id (anthy-utf8-context-ac-id ac))) + (begin + (anthy-utf8-lib-commit-segment ac-id -2 -128))))) + (define anthy-utf8-proc-transposing-state (lambda (ac key key-state) (let ((rotate-list '()) (state #f)) + (if (or (= my-state 1) (= my-check 1)) + (if (anthy-transpose-as-hiragana-key? key key-state) + (set! rotate-list (cons anthy-type-hiragana rotate-list)))) + (if (anthy-transpose-as-fullwidth-alnum-key? key key-state) (set! rotate-list (cons anthy-type-fullwidth-alnum rotate-list))) (if (anthy-transpose-as-halfwidth-alnum-key? key key-state) @@ -821,9 +904,8 @@ (if (anthy-transpose-as-halfkana-key? key key-state) (set! rotate-list (cons anthy-type-halfkana rotate-list))) (if (anthy-transpose-as-katakana-key? key key-state) - (set! rotate-list (cons anthy-type-katakana rotate-list))) - (if (anthy-transpose-as-hiragana-key? key key-state) - (set! rotate-list (cons anthy-type-hiragana rotate-list))) + (begin (set! rotate-list (cons anthy-type-katakana rotate-list)) + (set! my-check 1))) (if (anthy-utf8-context-transposing ac) (let ((lst (member (anthy-utf8-context-transposing-type ac) rotate-list))) @@ -858,7 +940,8 @@ ; commit (if (anthy-commit-key? key key-state) (begin - (anthy-utf8-learn-transposing-text ac) + ;;(anthy-utf8-learn-transposing-text ac) + (anthy-utf8-commit-transposing-text ac) ;; Patched by G-HAL, Wed,29 Apr,2009 (im-commit ac (anthy-utf8-lib-eucjp-to-utf8 (anthy-utf8-transposing-text ac))) (anthy-utf8-flush ac) #f) @@ -907,7 +990,7 @@ (nr (anthy-utf8-lib-get-nr-predictions ac-id)) (idx (anthy-utf8-context-prediction-index ac)) (n (if (not idx) - 0 + 0 (+ idx offset))) (compensated-n (cond ((>= n nr) @@ -956,7 +1039,7 @@ (im-select-candidate ac compensated-idx) #t) #f)))) - + (define anthy-utf8-prediction-select-non-existing-index? (lambda (ac numeralc) (let* ((ac-id (anthy-utf8-context-ac-id ac)) @@ -1103,7 +1186,7 @@ (anthy-utf8-reset-prediction-window ac) (anthy-utf8-begin-conv ac)) - ;; prediction + ;; prediction ((anthy-next-prediction-key? key key-state) (anthy-utf8-check-prediction ac #t)) @@ -1133,7 +1216,7 @@ ((anthy-kill-key? key key-state) (ustr-clear-latter! preconv-str) (ustr-clear-latter! raw-str)) - + ;; kill-backward ((anthy-kill-backward-key? key key-state) (rk-flush rkc) @@ -1223,6 +1306,7 @@ ;; commit ((anthy-commit-key? key key-state) (begin + (anthy-utf8-commit-unconverted-transposing-text ac) ;; Patched by G-HAL, Wed,22 Apr,2009 (im-commit ac (anthy-utf8-lib-eucjp-to-utf8 (anthy-utf8-make-whole-string ac #t kana))) @@ -1265,9 +1349,9 @@ (ustr-cursor-move-end! raw-str)) ;; modifiers (except shift) => ignore - ((and (modifier-key-mask key-state) - (not (shift-key-mask key-state))) - #f) +;; ((and (modifier-key-mask key-state) +;; (not (shift-key-mask key-state))) +;; #f) ((anthy-non-composing-symbol? ac key) #f) @@ -1292,7 +1376,7 @@ (begin (ustr-insert-elem! preconv-str residual-kana) (ustr-insert-elem! raw-str pend))))) - (ustr-insert-elem! preconv-str + (ustr-insert-elem! preconv-str (if (= (anthy-utf8-context-alnum-type ac) anthy-type-halfwidth-alnum) (list key-str key-str key-str) @@ -1306,7 +1390,7 @@ (charcode->string key)) (if (symbol? key) (symbol->string key) - (charcode->string (ichar-downcase key))))) + (charcode->string key)))) (pend (rk-pending rkc)) (res (rk-push-key! rkc key-str))) (if (and res @@ -1504,7 +1588,7 @@ (define anthy-utf8-predicting-state-preedit (lambda (ac) - (if (or + (if (or (not anthy-use-implicit-commit-prediction?) (not (anthy-utf8-context-prediction-index ac))) (anthy-utf8-input-state-preedit ac) @@ -1512,7 +1596,7 @@ (list (cons (bitwise-ior preedit-reverse preedit-cursor) cand)))))) (define anthy-utf8-converting-state-preedit - (lambda (ac) + (lambda (ac) (set! my-state 1) (let* ((ac-id (anthy-utf8-context-ac-id ac)) (segments (anthy-utf8-context-segments ac)) (cur-seg (ustr-cursor-pos segments)) @@ -1584,7 +1668,7 @@ (ustr-whole-seq segments))))) (define anthy-utf8-do-commit - (lambda (ac) + (lambda (ac) (set! my-state 0)(set! my-check 0) (im-commit ac (anthy-utf8-get-commit-string ac)) (anthy-utf8-commit-string ac) (anthy-utf8-reset-candidate-window ac) @@ -1772,16 +1856,16 @@ ((anthy-commit-key? key key-state) (anthy-utf8-do-commit ac)) - + ((anthy-extend-segment-key? key key-state) (anthy-utf8-resize-segment ac 1)) - + ((anthy-shrink-segment-key? key key-state) (anthy-utf8-resize-segment ac -1)) - + ((anthy-next-segment-key? key key-state) (anthy-utf8-move-segment ac 1)) - + ((anthy-prev-segment-key? key key-state) (anthy-utf8-move-segment ac -1)) @@ -1889,6 +1973,20 @@ (anthy-utf8-context-set-prediction-index! ac idx) (anthy-utf8-update-preedit ac))))) +;; Patched by G-HAL, Thu,16 Jul,2009 +(define anthy-utf8-place-handler + (lambda (ac) + (if (anthy-utf8-context-on ac) + (anthy-utf8-reset-commit-transposing-text ac)) + )) + +;; Patched by G-HAL, Thu,16 Jul,2009 +(define anthy-utf8-displace-handler + (lambda (ac) + (if (anthy-utf8-context-on ac) + (anthy-utf8-reset-commit-transposing-text ac)) + )) + (anthy-utf8-configure-widgets) (register-im @@ -1910,6 +2008,6 @@ #f #f #f - #f - #f + anthy-utf8-place-handler + anthy-utf8-displace-handler ) diff -upr uim-15f0788.org/scm/anthy.scm uim-15f0788/scm/anthy.scm --- uim-15f0788.org/scm/anthy.scm 2022-09-27 12:14:09.000000000 +0900 +++ uim-15f0788/scm/anthy.scm 2023-04-08 08:17:39.394484000 +0900 @@ -58,6 +58,7 @@ (define anthy-input-rule-act 3) (define anthy-input-rule-kzik 4) +(define anthy-candidate-type-unconverted -1) ;; Patched by G-HAL, Wed,22 Apr,2009 (define anthy-candidate-type-katakana -2) (define anthy-candidate-type-hiragana -3) (define anthy-candidate-type-halfkana -4) @@ -550,6 +551,7 @@ (anthy-context-set-on! ac #t) (rk-flush (anthy-context-rkc ac)) (anthy-context-set-converting! ac #f) + (anthy-reset-commit-transposing-text ac) ;; Patched by G-HAL, Tue,28 Apr,2009 #t) #f))) @@ -567,7 +569,7 @@ ()))) (context-update-preedit ac segments)) (anthy-context-set-commit-raw! ac #f)))) - + (define anthy-proc-raw-state (lambda (ac key key-state) (if (not (anthy-begin-input ac key key-state)) @@ -643,11 +645,13 @@ (anthy-context-set-on! ac #f)) ((anthy-backspace-key? key key-state) - (anthy-commit-raw ac)) + (anthy-commit-raw ac) + (anthy-forget-commit-transposing-text ac) ;; Patched by G-HAL, Wed,29 Apr,2009, Tue,14 Jul,2009 + ) ((anthy-delete-key? key key-state) (anthy-commit-raw ac)) - + ((and (anthy-hiragana-key? key key-state) (not @@ -704,11 +708,16 @@ ;; modifiers (except shift) => ignore ((and (modifier-key-mask key-state) (not (shift-key-mask key-state))) - (anthy-commit-raw ac)) - + (anthy-commit-raw ac) + (anthy-reset-commit-transposing-text ac) ;; Patched by G-HAL, Mon,20 Jul,2009 + ) + ;; direct key => commit (direct - (im-commit ac direct)) + (im-commit ac direct) + (anthy-reset-commit-transposing-text ac) ;; Patched by G-HAL, Tue,14 Jul,2009 + ) ;; space key => commit ((anthy-space-key? key key-state) @@ -719,8 +728,28 @@ anthy-type-halfwidth-alnum))) (im-commit ac (list-ref ja-space (anthy-context-kana-mode ac))))) + ;; Patched by G-HAL, Wed,29 Apr,2009 + ((generic-go-up-key? key key-state) + (anthy-commit-raw ac) + (anthy-reset-commit-transposing-text ac) + ) + ((generic-go-down-key? key key-state) + (anthy-commit-raw ac) + (anthy-reset-commit-transposing-text ac) + ) + ((generic-go-left-key? key key-state) + (anthy-commit-raw ac) + (anthy-reset-commit-transposing-text ac) + ) + ((generic-go-right-key? key key-state) + (anthy-commit-raw ac) + (anthy-reset-commit-transposing-text ac) + ) + ((anthy-non-composing-symbol? ac key) - (anthy-commit-raw ac)) + (anthy-commit-raw ac) + (anthy-reset-commit-transposing-text ac) ;; Patched by G-HAL, Tue,14 Jul,2009 + ) (else (if (anthy-context-alnum ac) @@ -742,7 +771,7 @@ (charcode->string key)) (if (symbol? key) (symbol->string key) - (charcode->string (ichar-downcase key))))) + (charcode->string key)))) (res (rk-push-key! rkc key-str))) (if res (begin @@ -802,6 +831,52 @@ (expand-segment) (anthy-lib-commit-segment ac-id 0 type)))))) +;; Patched by G-HAL, Wed,29 Apr,2009 +(define anthy-commit-transposing-text + (lambda (ac) + (let ((ac-id (anthy-context-ac-id ac)) + (transposing-type (anthy-context-transposing-type ac)) + (preconv-str (anthy-make-whole-string ac #t anthy-type-hiragana)) + (type #f)) + (cond + ((= transposing-type anthy-type-hiragana) + (set! type anthy-candidate-type-hiragana)) + ((= transposing-type anthy-type-katakana) + (set! type anthy-candidate-type-katakana)) + ((= transposing-type anthy-type-halfkana) + (set! type anthy-candidate-type-halfkana))) + (if (and ac-id + (> (string-length preconv-str) 0) + type) + (begin + (anthy-lib-set-string ac-id preconv-str) + (anthy-lib-commit-segment ac-id -1 type)))))) + +;; Patched by G-HAL, Wed,22 Apr,2009, Wed,29 Apr,2009 +(define anthy-commit-unconverted-transposing-text + (lambda (ac) + (let ((ac-id (anthy-context-ac-id ac)) + (preconv-str (anthy-make-whole-string ac #t anthy-type-hiragana))) + (if (and ac-id + (> (string-length preconv-str) 0)) + (begin + (anthy-lib-set-string ac-id preconv-str) + (anthy-lib-commit-segment ac-id -1 anthy-candidate-type-unconverted)))))) + +;; Patched by G-HAL, Sat,25 Apr,2009 +(define anthy-reset-commit-transposing-text + (lambda (ac) + (let ((ac-id (anthy-context-ac-id ac))) + (begin + (anthy-lib-commit-segment ac-id -1 -128))))) + +;; Patched by G-HAL, Tue,14 Jul,2009 +(define anthy-forget-commit-transposing-text + (lambda (ac) + (let ((ac-id (anthy-context-ac-id ac))) + (begin + (anthy-lib-commit-segment ac-id -2 -128))))) + (define anthy-proc-transposing-state (lambda (ac key key-state) (let ((rotate-list '()) @@ -850,7 +925,8 @@ ; commit (if (anthy-commit-key? key key-state) (begin - (anthy-learn-transposing-text ac) + ;;(anthy-learn-transposing-text ac) + (anthy-commit-transposing-text ac) ;; Patched by G-HAL, Wed,29 Apr,2009 (im-commit ac (anthy-transposing-text ac)) (anthy-flush ac) #f) @@ -899,7 +975,7 @@ (nr (anthy-lib-get-nr-predictions ac-id)) (idx (anthy-context-prediction-index ac)) (n (if (not idx) - 0 + 0 (+ idx offset))) (compensated-n (cond ((>= n nr) @@ -948,7 +1024,7 @@ (im-select-candidate ac compensated-idx) #t) #f)))) - + (define anthy-prediction-select-non-existing-index? (lambda (ac numeralc) (let* ((ac-id (anthy-context-ac-id ac)) @@ -1095,7 +1171,7 @@ (anthy-reset-prediction-window ac) (anthy-begin-conv ac)) - ;; prediction + ;; prediction ((anthy-next-prediction-key? key key-state) (anthy-check-prediction ac #t)) @@ -1125,7 +1201,7 @@ ((anthy-kill-key? key key-state) (ustr-clear-latter! preconv-str) (ustr-clear-latter! raw-str)) - + ;; kill-backward ((anthy-kill-backward-key? key key-state) (rk-flush rkc) @@ -1215,6 +1291,7 @@ ;; commit ((anthy-commit-key? key key-state) (begin + (anthy-commit-unconverted-transposing-text ac) ;; Patched by G-HAL, Wed,22 Apr,2009 (im-commit ac (anthy-make-whole-string ac #t kana)) @@ -1257,9 +1334,9 @@ (ustr-cursor-move-end! raw-str)) ;; modifiers (except shift) => ignore - ((and (modifier-key-mask key-state) - (not (shift-key-mask key-state))) - #f) +;; ((and (modifier-key-mask key-state) +;; (not (shift-key-mask key-state))) +;; #f) ((anthy-non-composing-symbol? ac key) #f) @@ -1284,7 +1361,7 @@ (begin (ustr-insert-elem! preconv-str residual-kana) (ustr-insert-elem! raw-str pend))))) - (ustr-insert-elem! preconv-str + (ustr-insert-elem! preconv-str (if (= (anthy-context-alnum-type ac) anthy-type-halfwidth-alnum) (list key-str key-str key-str) @@ -1298,7 +1375,7 @@ (charcode->string key)) (if (symbol? key) (symbol->string key) - (charcode->string (ichar-downcase key))))) + (charcode->string key)))) (pend (rk-pending rkc)) (res (rk-push-key! rkc key-str))) (if (and res @@ -1492,7 +1569,7 @@ (define anthy-predicting-state-preedit (lambda (ac) - (if (or + (if (or (not anthy-use-implicit-commit-prediction?) (not (anthy-context-prediction-index ac))) (anthy-input-state-preedit ac) @@ -1760,16 +1837,16 @@ ((anthy-commit-key? key key-state) (anthy-do-commit ac)) - + ((anthy-extend-segment-key? key key-state) (anthy-resize-segment ac 1)) - + ((anthy-shrink-segment-key? key key-state) (anthy-resize-segment ac -1)) - + ((anthy-next-segment-key? key key-state) (anthy-move-segment ac 1)) - + ((anthy-prev-segment-key? key key-state) (anthy-move-segment ac -1)) @@ -1877,6 +1954,20 @@ (anthy-context-set-prediction-index! ac idx) (anthy-update-preedit ac))))) +;; Patched by G-HAL, Thu,16 Jul,2009 +(define anthy-place-handler + (lambda (ac) + (if (anthy-context-on ac) + (anthy-reset-commit-transposing-text ac)) + )) + +;; Patched by G-HAL, Thu,16 Jul,2009 +(define anthy-displace-handler + (lambda (ac) + (if (anthy-context-on ac) + (anthy-reset-commit-transposing-text ac)) + )) + (anthy-configure-widgets) (register-im @@ -1898,6 +1989,6 @@ #f #f #f - #f - #f + anthy-place-handler + anthy-displace-handler ) diff -upr uim-15f0788.org/scm/generic-key-custom.scm uim-15f0788/scm/generic-key-custom.scm --- uim-15f0788.org/scm/generic-key-custom.scm 2022-09-27 12:14:09.000000000 +0900 +++ uim-15f0788/scm/generic-key-custom.scm 2018-11-06 21:02:47.000000000 +0900 @@ -152,3 +152,18 @@ '(key) (N_ "[Global] return") (N_ "long description will be here")) + +;; Patched by G-HAL, Wed,29 Apr,2009 +(define-custom 'generic-go-up-key '("up" "p") + '(global-keys2) + '(key) + (N_ "[Global] go up") + (N_ "long description will be here")) + +(define-custom 'generic-go-down-key '("down" "n") + '(global-keys2) + '(key) + (N_ "[Global] go down") + (N_ "long description will be here")) + +;; [ End of File ]