[uim-commit] r773 - branches/composer/scm

yamaken at freedesktop.org yamaken at freedesktop.org
Mon Mar 7 11:25:25 PST 2005


Author: yamaken
Date: 2005-03-07 11:25:21 -0800 (Mon, 07 Mar 2005)
New Revision: 773

Modified:
   branches/composer/scm/anthy-custom.scm
   branches/composer/scm/anthy.scm
Log:
* This commit adds the experimental feature "Transpose pre-convert
  string also when segment transposed". This will be replaced with
  segment re-editing feature based on the composer framework

* scm/anthy-custom.scm
  - (custom-group anthy-advanced, custom-group transposition): New
    custom group
  - (custom anthy-commit-transposed-preedit-immediately?): Modify
    group and description
  - (custom anthy-transpose-sub-preconv-with-segment?): New custom
    variable
* scm/anthy.scm
  - (anthy-transpose-sub-preconv!): New procedure
  - (anthy-get-nth-candidate): Add the
    preconv-transposition-by-segment-transposition feature


Modified: branches/composer/scm/anthy-custom.scm
===================================================================
--- branches/composer/scm/anthy-custom.scm	2005-03-07 18:15:55 UTC (rev 772)
+++ branches/composer/scm/anthy-custom.scm	2005-03-07 19:25:21 UTC (rev 773)
@@ -39,13 +39,28 @@
                      (ugettext anthy-im-name-label)
                      (ugettext anthy-im-short-desc))
 
+(define-custom-group 'anthy-advanced
+                     (_ "Anthy (advanced)")
+                     (_ "Advanced settings for Anthy"))
 
+;; subgroup
+(define-custom-group 'transposition
+                     (_ "Preedit string transposition (character set conversion)")
+                     (_ "Preedit string transposition (character set conversion)"))
+
+
 (define-custom 'anthy-commit-transposed-preedit-immediately? #f
-  '(anthy)
+  '(anthy-advanced transposition)
   '(boolean)
-  (_ "Immediately commit after preedit transposition (character set conversion)")
+  (_ "Immediately commit after pre-convert transposition")
   (_ "long description will be here."))
 
+(define-custom 'anthy-transpose-sub-preconv-with-segment? #t
+  '(anthy-advanced transposition)
+  '(boolean)
+  (_ "Transpose pre-convert string also when segment transposed")
+  (_ "long description will be here."))
+
 ;;
 ;; segment separator
 ;;

Modified: branches/composer/scm/anthy.scm
===================================================================
--- branches/composer/scm/anthy.scm	2005-03-07 18:15:55 UTC (rev 772)
+++ branches/composer/scm/anthy.scm	2005-03-07 19:25:21 UTC (rev 773)
@@ -900,6 +900,25 @@
 	   (opposite-kana (multi-segment-opposite-kana kana)))
       (anthy-switch-kana-mode! ac opposite-kana))))
 
+;; experimental feature
+(define anthy-transpose-sub-preconv!
+  (lambda (ac transpose-idx start len)
+    (let* ((orig (ustr-dup (anthy-context-preconv-ustr ac)))
+	   (former (evmap-ustr-substr-visible orig 0 start))
+	   (cur-seg (evmap-ustr-substr-visible orig start len))
+	   (latter (begin
+		     (evmap-ustr-set-visible-pos! orig (+ start len))
+		     (ustr-clear-former! orig)
+		     orig))
+	   (ruletree (anthy-transpose-idx->ruletree ac transpose-idx))
+	   (transposed (evmap-ustr-transpose cur-seg ruletree)))
+      (ustr-prepend! transposed (ustr-whole-seq former))
+      (ustr-append! transposed (ustr-whole-seq latter))
+      (anthy-context-set-preconv-ustr! ac transposed)
+      ;; ruletree has changed temporarily until commit to re-edit with
+      ;; transposed charset
+      (anthy-context-set-ruletree! ac ruletree))))
+
 (define anthy-transpose-preconv!
   (lambda (ac transpose-idx)
     (let* ((preconv-ustr (anthy-context-preconv-ustr ac))
@@ -1117,7 +1136,6 @@
 	((action_anthy_transpose_to_full_alnum)
 	 (transpose ac anthy-transpose-idx-wide-latin))
 
-	;; commit current preedit string, then toggle hiragana/katakana mode.
 	((action_anthy_commit_and_toggle_kana)
 	 (anthy-commit-preconv! ac)
 	 (anthy-toggle-kana-mode! ac))
@@ -1187,6 +1205,8 @@
 						      seg-len))
 		 (cand-ruletree (anthy-transpose-idx->ruletree ac cand-idx))
 		 (cand-ustr (evmap-ustr-transpose seg-ustr cand-ruletree)))
+	    (if anthy-transpose-sub-preconv-with-segment?
+		(anthy-transpose-sub-preconv! ac cand-idx seg-pos seg-len))
 	    (evmap-ustr-preedit-string cand-ustr))))))
 
 (define anthy-converting-state-preedit



More information about the Uim-commit mailing list