[uim-commit] r2180 - in trunk: scm uim

ekato at freedesktop.org ekato at freedesktop.org
Sun Nov 20 02:58:43 PST 2005


Author: ekato
Date: 2005-11-20 02:58:40 -0800 (Sun, 20 Nov 2005)
New Revision: 2180

Modified:
   trunk/scm/skk-key-custom.scm
   trunk/scm/skk.scm
   trunk/uim/skk.c
Log:
* uim/skk.c (skk_get_nth_completion) : Return "" if no completion
  word is found instead of uim_scm_null_list().
(skk-begin-completion-key) : Add
  skk-new-completion-from-current-comp-key.
* scm/skk-key-custom.scm
  (skk-new-completion-from-current-comp-key) : New key definition.
(skk-begin-completion-key) : Add
  skk-new-completion-from-current-comp-key.
(skk-begin-conv-with-completion-key) : Move category from
  skk-keys2 into skk-keys3.
(skk-commit-with-conv-completion-key) : Ditto.
* scm/skk.scm (skk-begin-completion) : Follow ddskk's behavior.
(skk-do-update-preedit) : Follow the changed in
  skk-begin-completion.
(skk-proc-state-completion) : Handle
  skk-new-completion-from-current-comp-key?


Modified: trunk/scm/skk-key-custom.scm
===================================================================
--- trunk/scm/skk-key-custom.scm	2005-11-20 08:01:14 UTC (rev 2179)
+++ trunk/scm/skk-key-custom.scm	2005-11-20 10:58:40 UTC (rev 2180)
@@ -160,7 +160,7 @@
 	       (_ "[SKK] begin latin conversion")
 	       (_ "long description will be here"))
 
-(define-custom 'skk-begin-completion-key '("tab" "<IgnoreCase><Control>i")
+(define-custom 'skk-begin-completion-key '("tab" "<IgnoreCase><Control>i" skk-new-completion-from-current-comp-key)
                '(skk-keys2 skk-keys-completion)
 	       '(key)
 	       (_ "[SKK] begin completion")
@@ -178,14 +178,20 @@
 	       (_ "[SKK] previous completion candidate")
 	       (_ "long description will be here"))
 
+(define-custom 'skk-new-completion-from-current-comp-key '("<IgnoreCase><Control><Alt>i")
+	       '(skk-keys3 skk-keys-completion)
+	       '(key)
+	       (_ "[SKK] new completion using current completion")
+	       (_ "long description will be here"))
+
 (define-custom 'skk-begin-conv-with-completion-key '("<Alt> ")
-	       '(skk-keys2 skk-keys-completion)
+	       '(skk-keys3 skk-keys-completion)
 	       '(key)
 	       (_ "[SKK] begin conversion with completion")
 	       (_ "long description will be here"))
 
 (define-custom 'skk-commit-with-conv-completion-key '("<IgnoreCase><Control><Alt>j")
-	       '(skk-keys2 skk-keys-completion)
+	       '(skk-keys3 skk-keys-completion)
 	       '(key)
 	       (_ "[SKK] commit the first candidate with completion")
 	       (_ "long description will be here"))

Modified: trunk/scm/skk.scm
===================================================================
--- trunk/scm/skk.scm	2005-11-20 08:01:14 UTC (rev 2179)
+++ trunk/scm/skk.scm	2005-11-20 10:58:40 UTC (rev 2180)
@@ -656,20 +656,14 @@
 
 (define skk-begin-completion
   (lambda (sc)
-    (let ((res #f))
-      ;; get residual 'n'
-      (if (eq? (skk-context-state sc) 'skk-state-kanji)
-	  (skk-append-residual-kana sc))
-      ;;
-      (set! res
-	    (skk-lib-get-completion
-	     (skk-make-string (skk-context-head sc) (skk-context-kana-mode sc))
-	     skk-use-numeric-conversion?))
-      (if res
-	  (begin
-	    (skk-context-set-completion-nth! sc 0)
-	    (skk-context-set-state! sc 'skk-state-completion)))
-      )))
+    ;; get residual 'n'
+    (if (eq? (skk-context-state sc) 'skk-state-kanji)
+	(skk-append-residual-kana sc))
+    (skk-lib-get-completion
+     (skk-make-string (skk-context-head sc) (skk-context-kana-mode sc))
+     skk-use-numeric-conversion?)
+    (skk-context-set-completion-nth! sc 0)
+    (skk-context-set-state! sc 'skk-state-completion)))
 
 (define skk-dcomp-word-tail
   (lambda (sc)
@@ -784,10 +778,14 @@
       (if (and
 	   (eq? stat 'skk-state-completion)
 	   (null? csc))
-	  (begin
+	  (let ((comp (skk-get-current-completion sc)))
 	    (im-pushback-preedit
 	     sc skk-preedit-attr-head
-	     (skk-get-current-completion sc))))
+	     (if (not (string=? comp ""))
+		 comp
+		 (skk-make-string 
+		  (skk-context-head sc)
+		  (skk-context-kana-mode sc))))))
       ;; okuri mark
       (if (or
 	   (eq? stat 'skk-state-okuri)
@@ -1779,6 +1777,26 @@
        (if (skk-prev-completion-key? key key-state)
 	   (skk-change-completion-index sc #f)
 	   #t)
+       (if (skk-new-completion-from-current-comp-key? key key-state)
+	   (let* ((comp (skk-get-current-completion sc))
+		  (sl (string-to-list comp)))
+	     (if (not (null? sl))
+		 (begin (skk-lib-get-completion
+			 (skk-get-current-completion sc)
+			 skk-use-numeric-conversion?)))
+	     (skk-lib-clear-completions
+	      (skk-make-string
+	       (skk-context-head sc)
+	       skk-type-hiragana)
+	       skk-use-numeric-conversion?)
+
+	     (if (not (null? sl))
+		 (begin
+		   (skk-context-set-head! sc '())
+		   (skk-string-list-to-context-head sc sl)))
+	     (skk-context-set-completion-nth! sc 0)
+	     #f)
+	   #t)
        (if (skk-cancel-key? key key-state)
 	   (begin
 	     (skk-lib-clear-completions
@@ -1791,10 +1809,12 @@
 	   #t)
        (let ((sl (string-to-list (skk-get-current-completion sc))))
 	 (skk-lib-clear-completions
-	   (skk-make-string (skk-context-head sc) (skk-context-kana-mode sc))
-	   skk-use-numeric-conversion?)
-	 (skk-context-set-head! sc '())
-	 (skk-string-list-to-context-head sc sl)
+	  (skk-make-string (skk-context-head sc) (skk-context-kana-mode sc))
+	  skk-use-numeric-conversion?)
+	 (if (not (null? sl))
+	     (begin
+	       (skk-context-set-head! sc '())
+	       (skk-string-list-to-context-head sc sl)))
 	 (skk-context-set-state! sc 'skk-state-kanji)
 	 (skk-proc-state-kanji c key key-state)))
       #f)))

Modified: trunk/uim/skk.c
===================================================================
--- trunk/uim/skk.c	2005-11-20 08:01:14 UTC (rev 2179)
+++ trunk/uim/skk.c	2005-11-20 10:58:40 UTC (rev 2180)
@@ -1866,7 +1866,7 @@
     if (!uim_scm_nullp(numlst_))
       return skk_get_nth_completion(nth_, head_, uim_scm_f());
     else
-      return uim_scm_null_list();
+      return uim_scm_make_str("");
   }
 
   n = uim_scm_c_int(nth_);
@@ -1882,7 +1882,7 @@
     return skk_get_nth_completion(uim_scm_make_int(n - ca->nr_comps),
 		    head_, uim_scm_f());
 
-  return uim_scm_null_list();
+  return uim_scm_make_str("");
 }
 
 static uim_lisp



More information about the uim-commit mailing list