Created
September 26, 2011 03:16
-
-
Save anyakichi/1241544 to your computer and use it in GitHub Desktop.
sticky key support for uim-skk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur uim-1.7.0.orig/scm/skk-key-custom.scm uim-1.7.0/scm/skk-key-custom.scm | |
--- uim-1.7.0.orig/scm/skk-key-custom.scm 2011-09-26 12:13:46.000000000 +0900 | |
+++ uim-1.7.0/scm/skk-key-custom.scm 2011-09-26 11:27:53.000000000 +0900 | |
@@ -140,6 +140,12 @@ | |
(N_ "[SKK] cancel") | |
(N_ "long description will be here")) | |
+(define-custom 'skk-sticky-key '() | |
+ '(skk-keys1) | |
+ '(key) | |
+ (N_ "[SKK] sticky") | |
+ (N_ "long description will be here")) | |
+ | |
;; | |
;; advanced 1 | |
;; | |
diff -ur uim-1.7.0.orig/scm/skk.scm uim-1.7.0/scm/skk.scm | |
--- uim-1.7.0.orig/scm/skk.scm 2011-09-26 12:13:46.000000000 +0900 | |
+++ uim-1.7.0/scm/skk.scm 2011-09-26 11:27:53.000000000 +0900 | |
@@ -1036,6 +1036,10 @@ | |
(skk-context-set-state! sc 'skk-state-kanji) | |
(skk-context-set-latin-conv! sc #t) | |
#f) | |
+ ((skk-sticky-key? key key-state) | |
+ (skk-context-set-state! sc 'skk-state-kanji) | |
+ (skk-context-set-latin-conv! sc #f) | |
+ #f) | |
((skk-kanji-mode-key? key key-state) | |
(skk-context-set-state! sc 'skk-state-kanji) | |
(skk-context-set-latin-conv! sc #f) | |
@@ -1140,6 +1144,15 @@ | |
(skk-context-set-latin-conv! sc #t) | |
#f) | |
#t) | |
+ (if (and (skk-sticky-key? key key-state) | |
+ (not (rk-expect-key? rkc key-str))) | |
+ (let* ((residual-kana (rk-push-key-last! rkc))) | |
+ (if residual-kana | |
+ (skk-commit sc (skk-get-string sc residual-kana kana))) | |
+ (skk-context-set-state! sc 'skk-state-kanji) | |
+ (skk-context-set-latin-conv! sc #f) | |
+ #f) | |
+ #t) | |
(if (and (skk-kanji-mode-key? key key-state) | |
(not (rk-expect-key? rkc key-str))) | |
(let* ((residual-kana (rk-push-key-last! rkc))) | |
@@ -1510,6 +1523,16 @@ | |
(skk-begin-conversion sc) | |
#f) | |
#t) | |
+ (if (skk-sticky-key? key key-state) | |
+ (if (null? (skk-context-head sc)) | |
+ (begin | |
+ (skk-commit sc (charcode->string key)) | |
+ (skk-flush sc) | |
+ #f) | |
+ (begin | |
+ (skk-context-set-state! sc 'skk-state-okuri) | |
+ #f)) | |
+ #t) | |
(if (and (skk-ichar-upper-case? key) | |
(not (null? (skk-context-head sc)))) | |
(let ((key-str (charcode->string (skk-ichar-downcase key)))) | |
@@ -2052,6 +2075,14 @@ | |
#f) | |
#t) | |
(begin | |
+ (if (string=? (skk-context-okuri-head sc) "") | |
+ (if (skk-rk-pending? sc) | |
+ (skk-context-set-okuri-head-using-alist! | |
+ sc | |
+ (car (reverse (rk-context-seq rkc)))) | |
+ (skk-context-set-okuri-head-using-alist! | |
+ sc | |
+ (charcode->string (skk-ichar-downcase key))))) | |
(set! res | |
(rk-push-key! | |
rkc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment