From 3cea2839928a13dc073ae7a74a19b978c6f5492e Mon Sep 17 00:00:00 2001 From: handa Date: Wed, 23 Jan 2008 02:57:32 +0000 Subject: [PATCH] (integer_value): Fix interpretation of "@-N". --- src/input.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 -- 1.7.10.4