[uim-commit] r833 - trunk/scm

ekato at freedesktop.org ekato at freedesktop.org
Fri May 6 00:50:13 PDT 2005


Author: ekato
Date: 2005-05-06 00:50:08 -0700 (Fri, 06 May 2005)
New Revision: 833

Modified:
   trunk/scm/skk-editor.scm
   trunk/scm/skk.scm
Log:
* scm/skk.scm (skk-flush) : Reset skk-context-nr-candidates here.
(skk-back-to-kanji-state) : Ditto.
(skk-commit-raw) : Indentation fix.
(skk-begin-conversion) : Ditto.
(skk-back-to-converting-state) : New function to go back to
  converting state from recursive learning state.
* scm/skk-editor.scm (skk-editor-commit-raw) : Go back to
  converting state on return key with null string and cancel key
  in recursive learning editor if at least one candidate word
  exists, otherwise go back to kanji state.


Modified: trunk/scm/skk-editor.scm
===================================================================
--- trunk/scm/skk-editor.scm	2005-05-06 05:37:09 UTC (rev 832)
+++ trunk/scm/skk-editor.scm	2005-05-06 07:50:08 UTC (rev 833)
@@ -154,15 +154,19 @@
 		       (skk-commit-editor-context sc str))
 		     (begin
 		       (skk-editor-flush ec)
-		       (skk-back-to-kanji-state sc)
-		       (skk-context-set-child-context! sc #f)))
+		       (skk-context-set-child-context! sc #f)
+		       (if (> (skk-context-nr-candidates sc) 0)
+			   (skk-back-to-converting-state sc)
+			   (skk-back-to-kanji-state sc))))
 		 #f)
 	       #t)
 	   (if (skk-cancel-key? key key-state)
 	       (begin
 		 (skk-editor-flush ec)
-		 (skk-back-to-kanji-state sc)
 		 (skk-context-set-child-context! sc #f)
+		 (if (> (skk-context-nr-candidates sc) 0)
+		     (skk-back-to-converting-state sc)
+		     (skk-back-to-kanji-state sc))
 		 #f)
 	       #t)
 	   )))))

Modified: trunk/scm/skk.scm
===================================================================
--- trunk/scm/skk.scm	2005-05-06 05:37:09 UTC (rev 832)
+++ trunk/scm/skk.scm	2005-05-06 07:50:08 UTC (rev 833)
@@ -342,6 +342,7 @@
     (skk-context-set-okuri! sc '())
     (skk-context-set-appendix! sc '())
     (skk-reset-candidate-window sc)
+    (skk-context-set-nr-candidates! sc 0)
     (skk-context-set-latin-conv! sc #f)))
 
 (define skk-context-new
@@ -500,9 +501,7 @@
   (lambda (sc key key-state)
     (let ((psc (skk-context-parent-context sc)))
       (if (not (null? psc))
-	  (skk-editor-commit-raw
-	   (skk-context-editor psc)
-	   key key-state)
+	  (skk-editor-commit-raw (skk-context-editor psc) key key-state)
 	  (begin
 	    (skk-context-set-commit-raw! sc #t)
 	    (im-commit-raw sc))))))
@@ -618,8 +617,7 @@
 	    (skk-check-candidate-window-begin sc)
 	    (if (skk-context-candidate-window sc)
 		(im-select-candidate sc 0))
-	    (skk-context-set-state!
-	     sc 'skk-state-converting))
+	    (skk-context-set-state! sc 'skk-state-converting))
 	  (if skk-use-recursive-learning?
 	      (skk-setup-child-context sc)
 	      (skk-flush sc))))))
@@ -1429,8 +1427,23 @@
 			       (append (skk-context-appendix sc)
 				       (skk-context-head sc))))
     (skk-context-set-okuri! sc '())
-    (skk-context-set-appendix! sc '())))
+    (skk-context-set-appendix! sc '())
+    (skk-context-set-nr-candidates! sc 0)))
 
+(define skk-back-to-converting-state
+  (lambda (sc)
+    (skk-context-set-nth! sc (- (skk-context-nr-candidates sc) 1))
+    (skk-check-candidate-window-begin sc)
+    (if (skk-context-candidate-window sc)
+	(cond
+	 ((= skk-candidate-selection-style 'uim)
+	  (im-select-candidate sc (skk-context-nth sc)))
+	 ((= skk-candidate-selection-style 'ddskk-like)
+	  (im-select-candidate
+	   sc
+	   (- (skk-context-nth sc) (- skk-candidate-op-count 1))))))
+    (skk-context-set-state! sc 'skk-state-converting)))
+
 (define skk-change-completion-index
   (lambda (sc incr)
     (if incr



More information about the Uim-commit mailing list