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

yamaken at freedesktop.org yamaken at freedesktop.org
Mon Mar 7 10:15:58 PST 2005


Author: yamaken
Date: 2005-03-07 10:15:55 -0800 (Mon, 07 Mar 2005)
New Revision: 772

Modified:
   branches/composer/scm/anthy.scm
Log:
* scm/anthy.scm
  - (evmap-ustr-transpose): Preserve proper cursor position while
    transposition is being performed even if kana<->alphanumeric case


Modified: branches/composer/scm/anthy.scm
===================================================================
--- branches/composer/scm/anthy.scm	2005-03-07 17:52:22 UTC (rev 771)
+++ branches/composer/scm/anthy.scm	2005-03-07 18:15:55 UTC (rev 772)
@@ -763,11 +763,16 @@
 
 (define evmap-ustr-transpose
   (lambda (ustr new-ruletree)
-    (fold (lambda (ev new-ustr)
-	    (evmap-ustr-input! new-ustr new-ruletree ev)
-	    new-ustr)
-	  (ustr-new)
-	  (append-map-ustr-whole evmap-context-event-seq ustr))))
+    (let* ((former-seq (append-map-ustr-former evmap-context-event-seq ustr))
+	   (latter-seq (append-map-ustr-latter evmap-context-event-seq ustr))
+	   (inject (lambda (ev new-ustr)
+		     (evmap-ustr-input! new-ustr new-ruletree ev)
+		     new-ustr))
+	   (transposed (fold inject (ustr-new) former-seq))
+	   (pos (ustr-cursor-pos transposed)))
+      (fold inject transposed latter-seq)
+      (ustr-set-cursor-pos! transposed pos)
+      transposed)))
 
 (define anthy-ruletree
   (lambda (input-rule kana-mode on? wide? has-preedit?)



More information about the Uim-commit mailing list