From: handa Date: Wed, 23 Jan 2008 02:57:32 +0000 (+0000) Subject: (integer_value): Fix interpretation of "@-N". X-Git-Tag: REL-1-5-1~14 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=3cea2839928a13dc073ae7a74a19b978c6f5492e;p=m17n%2Fm17n-lib.git (integer_value): Fix interpretation of "@-N". --- diff --git a/src/input.c b/src/input.c index 1b4d6f1..95cfff0 100644 --- a/src/input.c +++ b/src/input.c @@ -657,7 +657,10 @@ integer_value (MInputContext *ic, MPlist *arg, MPlist **value, int surrounding) pos = atoi (name + 1); if (pos == 0) return get_preceding_char (ic, 0); - pos = ic->cursor_pos + pos; + if (pos < 0) + pos = ic->cursor_pos + pos; + else + pos = ic->cursor_pos + pos - 1; if (pos < 0) { if (ic->produced && mtext_len (ic->produced) + pos >= 0) @@ -665,9 +668,7 @@ integer_value (MInputContext *ic, MPlist *arg, MPlist **value, int surrounding) mtext_len (ic->produced) + pos); return get_preceding_char (ic, - pos); } - else - pos--; - if (pos >= len) + else if (pos >= len) return get_following_char (ic, pos - len); } else