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

ekato@freedesktop.org ekato@freedesktop.org
Thu Jan 27 11:57:26 PST 2005


Author: ekato
Date: 2005-01-27 11:57:21 -0800 (Thu, 27 Jan 2005)
New Revision: 366

Modified:
   trunk/scm/skk-custom.scm
   trunk/scm/skk.scm
   trunk/uim/skk-dic.c
Log:
* uim/skk-dic.c (skk_lib_remove_annotation) : Add check for empty
  list.
(skk_lib_get_annotation) : Ditto.
* scm/skk-custom.scm : Add new custom boolean variable
  'skk-show-annotation?  Default is #t.
* scm/skk.scm (skk-get-nth-candidate) : Check skk-show-annotation?
(skk-do-update-preedit) : Don't show annotation in preedit area.
  This is ddskk compatible behavior.


Modified: trunk/scm/skk-custom.scm
===================================================================
--- trunk/scm/skk-custom.scm	2005-01-27 04:17:32 UTC (rev 365)
+++ trunk/scm/skk-custom.scm	2005-01-27 19:57:21 UTC (rev 366)
@@ -108,6 +108,12 @@
   (_ "Enable auto conversion with punctuation marks")
   (_ "long description will be here."))
 
+(define-custom 'skk-show-annotation? #t
+  '(skk advanced)
+  '(boolean)
+  (_ "Show annotation in candidate window")
+  (_ "long description will be here."))
+
 (define-custom 'skk-dic-file-name (string-append (sys-datadir)
 						 "/skk/SKK-JISYO.L")
   '(skk)

Modified: trunk/scm/skk.scm
===================================================================
--- trunk/scm/skk.scm	2005-01-27 04:17:32 UTC (rev 365)
+++ trunk/scm/skk.scm	2005-01-27 19:57:21 UTC (rev 366)
@@ -437,25 +437,31 @@
 
 (define skk-get-nth-candidate
   (lambda (sc n)
-    (let ((head (skk-context-head sc)))
-      (if skk-use-numeric-conversion?
-	  ;; store and restore numeric strings
-	  (let ((numlst (skk-lib-store-replaced-numstr
-			 (skk-make-string head skk-type-hiragana))))
-	    (skk-lib-merge-replaced-numstr
-	     (skk-lib-get-nth-candidate
-	      n
-	      (skk-lib-replace-numeric (skk-make-string head skk-type-hiragana))
-	      (skk-context-okuri-head sc)
-	      (skk-make-string (skk-context-okuri sc) skk-type-hiragana)
-	      numlst)
-	     numlst))
-	  (skk-lib-get-nth-candidate
-	   n
-	   (skk-make-string head skk-type-hiragana)
-	   (skk-context-okuri-head sc)
-	   (skk-make-string (skk-context-okuri sc) skk-type-hiragana)
-	   '())))))
+    (let* ((head (skk-context-head sc))
+    	   (cand (if skk-use-numeric-conversion?
+		     ;; store and restore numeric strings
+		     (let ((numlst (skk-lib-store-replaced-numstr
+				    (skk-make-string head skk-type-hiragana))))
+		       (skk-lib-merge-replaced-numstr
+			(skk-lib-get-nth-candidate
+			 n
+			 (skk-lib-replace-numeric (skk-make-string
+						   head skk-type-hiragana))
+			 (skk-context-okuri-head sc)
+			 (skk-make-string (skk-context-okuri sc)
+					  skk-type-hiragana)
+			 numlst)
+			numlst))
+		     (skk-lib-get-nth-candidate
+		      n
+		      (skk-make-string head skk-type-hiragana)
+		      (skk-context-okuri-head sc)
+		      (skk-make-string (skk-context-okuri sc)
+				       skk-type-hiragana)
+		      '()))))
+      (if skk-show-annotation?
+	  cand
+	  (skk-lib-remove-annotation cand)))))
 
 (define skk-get-current-candidate
   (lambda (sc)
@@ -655,7 +661,7 @@
 	     sc
 	     (bit-or skk-preedit-attr-conv-body
 		     preedit-cursor)
-	     (skk-get-current-candidate sc))
+	     (skk-lib-remove-annotation (skk-get-current-candidate sc)))
 	    (im-pushback-preedit
 	     sc skk-preedit-attr-conv-okuri
 	     (skk-make-string (skk-context-okuri sc)

Modified: trunk/uim/skk-dic.c
===================================================================
--- trunk/uim/skk-dic.c	2005-01-27 04:17:32 UTC (rev 365)
+++ trunk/uim/skk-dic.c	2005-01-27 19:57:21 UTC (rev 366)
@@ -1999,9 +1999,14 @@
 static uim_lisp
 skk_lib_get_annotation(uim_lisp str_)
 {
-  const char *str = uim_scm_refer_c_str(str_);
-  const char *sep = strrchr(str, ';');
+  const char *str, *sep;
   uim_lisp res;
+
+  if (str_ == uim_scm_null_list())
+    return uim_scm_null_list();
+
+  str = uim_scm_refer_c_str(str_);
+  sep = strrchr(str, ';');
   if (sep) {
     sep++;
     res = uim_scm_make_str(sep);
@@ -2014,9 +2019,14 @@
 static uim_lisp
 skk_lib_remove_annotation(uim_lisp str_)
 {
-  char *str = uim_scm_c_str(str_);
-  char *sep = strrchr(str, ';');
+  char *str, *sep;
   uim_lisp res;
+
+  if (str_ == uim_scm_null_list())
+    return uim_scm_null_list();
+
+  str = uim_scm_c_str(str_);
+  sep = strrchr(str, ';');
   if (sep) {
     *sep = 0;
   }



More information about the Uim-commit mailing list