[uim-commit] r284 - in trunk: gtk scm uim xim
ekato@freedesktop.org
ekato@freedesktop.org
Fri Jan 14 05:35:56 PST 2005
Author: ekato
Date: 2005-01-14 05:35:51 -0800 (Fri, 14 Jan 2005)
New Revision: 284
Modified:
trunk/gtk/gtk-im-uim.c
trunk/scm/anthy.scm
trunk/scm/generic.scm
trunk/scm/skk.scm
trunk/uim/slib.c
trunk/xim/ximserver.cpp
Log:
* scm/generic.scm : Add check for display limit with 0.
* scm/anthy.scm : Ditto.
* scm/skk.scm : Ditto.
* gtk/gtk-im-uim.c : Ditto.
* xim/ximserver.cpp : Ditto.
* uim/slib.c : Add fail safe behavior for Remainder and Quotient.
Modified: trunk/gtk/gtk-im-uim.c
===================================================================
--- trunk/gtk/gtk-im-uim.c 2005-01-14 13:10:32 UTC (rev 283)
+++ trunk/gtk/gtk-im-uim.c 2005-01-14 13:35:51 UTC (rev 284)
@@ -745,7 +745,7 @@
uic->cwin_is_active = TRUE;
for (i = 0; i < nr; i++) {
- cand = uim_get_candidate(uic->uc, i, i % display_limit);
+ cand = uim_get_candidate(uic->uc, i, display_limit ? i % display_limit : i);
list = g_slist_append(list, cand);
}
Modified: trunk/scm/anthy.scm
===================================================================
--- trunk/scm/anthy.scm 2005-01-14 13:10:32 UTC (rev 283)
+++ trunk/scm/anthy.scm 2005-01-14 13:35:51 UTC (rev 284)
@@ -820,7 +820,9 @@
(cur-seg (ustr-cursor-pos segments))
(max (anthy-lib-get-nr-candidates ac-id cur-seg))
(n (ustr-cursor-frontside segments))
- (cur-page (/ n anthy-nr-candidate-max))
+ (cur-page (if (= anthy-nr-candidate-max 0)
+ 0
+ (quotient n anthy-nr-candidate-max)))
(pageidx (- (numeral-char->number numeralc) 1))
(compensated-pageidx (cond
((< pageidx 0) ; pressing key_0
Modified: trunk/scm/generic.scm
===================================================================
--- trunk/scm/generic.scm 2005-01-14 13:10:32 UTC (rev 283)
+++ trunk/scm/generic.scm 2005-01-14 13:35:51 UTC (rev 284)
@@ -164,7 +164,9 @@
(let* ((rkc (generic-context-rk-context pc))
(cs (rk-current-seq rkc))
(n (generic-context-rk-nth pc) (cadr cs))
- (cur-page (/ n generic-nr-candidate-max))
+ (cur-page (if (= generic-nr-candidate-max 0)
+ 0
+ (quotient n generic-nr-candidate-max)))
(pageidx (- (numeral-char->number key) 1))
(compensated-pageidx (cond
((< pageidx 0) ; pressing key_0
Modified: trunk/scm/skk.scm
===================================================================
--- trunk/scm/skk.scm 2005-01-14 13:10:32 UTC (rev 283)
+++ trunk/scm/skk.scm 2005-01-14 13:35:51 UTC (rev 284)
@@ -1210,7 +1210,9 @@
(define skk-commit-by-label-key
(lambda (sc key)
(let ((nr (skk-context-nr-candidates sc))
- (cur-page (quotient (skk-context-nth sc) skk-nr-candidate-max))
+ (cur-page (if (= skk-nr-candidate-max 0)
+ 0
+ (quotient (skk-context-nth sc) skk-nr-candidate-max)))
(idx -1)
(res #f))
(if (numeral-char? key)
@@ -1573,7 +1575,9 @@
(skk-make-string okuri skk-type-hiragana))
cand)
;; FIXME make sure to enable lable other than number
- (digit->string (+ (remainder idx skk-nr-candidate-max) 1))
+ (if (= skk-nr-candidate-max 0)
+ (digit->string (+ idx 1))
+ (digit->string (+ (remainder idx skk-nr-candidate-max) 1)))
""))))
(define skk-set-candidate-index-handler
Modified: trunk/uim/slib.c
===================================================================
--- trunk/uim/slib.c 2005-01-14 13:10:32 UTC (rev 283)
+++ trunk/uim/slib.c 2005-01-14 13:35:51 UTC (rev 284)
@@ -1598,12 +1598,15 @@
(x) my_err ("wta(1st) to quotient", x);
if NULLP
(y)
- return (intcons (1 / INTNM (x))); /* XXX divided by 0 actually */
+ return (intcons (1 / INTNM (x))); /* XXX wrong number of arguments actually */
else
{
if NINTNUMP
(y) my_err ("wta(2nd) to quotient", y);
- return (intcons (INTNM (x) / INTNM (y)));
+ if (INTNM(y) == 0)
+ return (intcons (0)); /* divided by 0 actually */
+ else
+ return (intcons (INTNM (x) / INTNM (y)));
}
}
@@ -1614,12 +1617,15 @@
(x) my_err ("wta(1st) to remainder", x);
if NULLP
(y)
- return (intcons (1 % INTNM (x))); /* XXX divided by 0 actually */
+ return (intcons (1 % INTNM (x))); /* XXX wrong number of arguments actually */
else
{
if NINTNUMP
(y) my_err ("wta(2nd) to remainder", y);
- return (intcons (INTNM (x) % INTNM (y)));
+ if (INTNM(y) == 0)
+ return (intcons (INTNM (x))); /* divided by 0 actually */
+ else
+ return (intcons (INTNM (x) % INTNM (y)));
}
}
Modified: trunk/xim/ximserver.cpp
===================================================================
--- trunk/xim/ximserver.cpp 2005-01-14 13:10:32 UTC (rev 283)
+++ trunk/xim/ximserver.cpp 2005-01-14 13:35:51 UTC (rev 284)
@@ -675,7 +675,8 @@
Canddisp *disp = canddisp_singleton();
for (i = 0; i < nr; i++) {
- cand[i] = uim_get_candidate(mUc, i, i % display_limit);
+ cand[i] = uim_get_candidate(mUc, i,
+ display_limit ? i % display_limit : i);
cand_str = uim_candidate_get_cand_str(cand[i]);
heading_label = uim_candidate_get_heading_label(cand[i]);
//annotation_str = uim_candidate_get_annotation(cand[i]);
More information about the Uim-commit
mailing list