From 900c44863023c036567ab88967944c35c051f430 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Sun, 7 Sep 2008 01:11:46 +0000 Subject: [PATCH] (FORWARD_CHAR): Check STOP after incrementing (POSITION).pos. --- src/composite.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/composite.c b/src/composite.c index 6e9c823d8c1..dc1dd370c3b 100644 --- a/src/composite.c +++ b/src/composite.c @@ -1189,11 +1189,17 @@ struct position_record /* Update the members of POSTION to the next character boundary. */ #define FORWARD_CHAR(POSITION, STOP) \ do { \ - if ((POSITION).pos == (STOP)) \ - (POSITION).p = GAP_END_ADDR; \ (POSITION).pos++; \ - (POSITION).pos_byte += BYTES_BY_CHAR_HEAD (*((POSITION).p)); \ - (POSITION).p += BYTES_BY_CHAR_HEAD (*((POSITION).p)); \ + if ((POSITION).pos == (STOP)) \ + { \ + (POSITION).p = GAP_END_ADDR; \ + (POSITION).pos_byte = GPT_BYTE; \ + } \ + else \ + { \ + (POSITION).p += BYTES_BY_CHAR_HEAD (*((POSITION).p)); \ + (POSITION).pos_byte += BYTES_BY_CHAR_HEAD (*((POSITION).p)); \ + } \ } while (0) /* Update the members of POSTION to the previous character boundary. */ -- 2.39.5