[uim-commit] r727 - trunk/scm

ekato at freedesktop.org ekato at freedesktop.org
Fri Feb 25 20:51:01 PST 2005


Author: ekato
Date: 2005-02-25 20:50:58 -0800 (Fri, 25 Feb 2005)
New Revision: 727

Modified:
   trunk/scm/skk.scm
Log:
* scm/skk.scm (skk-change-candidate-index) : Fix potential crash
  and its behavior when pressing skk-prev-candidate-key? just
  after starting conversion.


Modified: trunk/scm/skk.scm
===================================================================
--- trunk/scm/skk.scm	2005-02-26 03:32:24 UTC (rev 726)
+++ trunk/scm/skk.scm	2005-02-26 04:50:58 UTC (rev 727)
@@ -1225,33 +1225,48 @@
 (define skk-change-candidate-index
   (lambda (sc incr)
     (let ((head (skk-context-head sc)))
-      (if incr
-	  (begin
-	    (skk-context-set-nth! sc
-				  (+ 1 (skk-context-nth sc)))
-	    (skk-context-set-candidate-op-count!
-	     sc
-	     (+ 1 (skk-context-candidate-op-count sc))))
-	  (begin
-	    (if (> (skk-context-nth sc) 0)
-		(skk-context-set-nth! sc (- (skk-context-nth sc) 1))
-		(skk-context-set-nth!
-		 sc
-		 (- (skk-context-nr-candidates sc) 1)))))
-      (if (null? (skk-get-current-candidate sc))
-	  (begin
-	    (skk-context-set-nth! sc 0)
-	    (if skk-use-recursive-learning?
-		(begin
-		  (skk-reset-candidate-window sc)
-		  (skk-setup-child-context sc)))))
-      (if (null? (skk-context-child-context sc))
-	  (begin
-	    ;; ¸õÊäWindow¤Îɽ¼¨¤ò³«»Ï¤¹¤ë¤«
-	    (skk-check-candidate-window-begin sc)
-	    ;;
-	    (if (skk-context-candidate-window sc)
-		(im-select-candidate sc (skk-context-nth sc)))))
+      (and
+       (if incr
+	   (begin
+	     (skk-context-set-nth! sc
+				   (+ 1 (skk-context-nth sc)))
+	     (skk-context-set-candidate-op-count!
+	      sc
+	      (+ 1 (skk-context-candidate-op-count sc)))
+	     #t)
+	   (begin
+	     (if (> (skk-context-nth sc) 0)
+		 (begin
+		   (skk-context-set-nth! sc (- (skk-context-nth sc) 1))
+		   #t)
+		 (begin
+		   (if (= (skk-context-nr-candidates sc) 0)
+		       (begin
+			 (skk-back-to-kanji-state sc)
+			 #f)
+		       (begin
+			 (skk-context-set-nth!
+			  sc
+			  (- (skk-context-nr-candidates sc) 1))
+			 #t))))))
+       (if (null? (skk-get-current-candidate sc))
+	   (begin
+	     (skk-context-set-nth! sc 0)
+	     (if skk-use-recursive-learning?
+		 (begin
+		   (skk-reset-candidate-window sc)
+		   (skk-setup-child-context sc)))
+	     #t)
+	   #t)
+       (if (null? (skk-context-child-context sc))
+	   (begin
+	     ;; ¸õÊäWindow¤Îɽ¼¨¤ò³«»Ï¤¹¤ë¤«
+	     (skk-check-candidate-window-begin sc)
+	     ;;
+	     (if (skk-context-candidate-window sc)
+		 (im-select-candidate sc (skk-context-nth sc)))
+	     #t)
+	   #t))
       #f)))
 
 (define skk-reset-candidate-window



More information about the Uim-commit mailing list