changeset 98068:9723eb0d11ab

(FORWARD_CHAR): Check STOP after incrementing (POSITION).pos.
author Kenichi Handa <handa@m17n.org>
date Sun, 07 Sep 2008 01:11:46 +0000
parents 72d94dcf4480
children 43a801a18b24
files src/composite.c
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/composite.c	Sun Sep 07 00:52:54 2008 +0000
+++ b/src/composite.c	Sun Sep 07 01:11:46 2008 +0000
@@ -1189,11 +1189,17 @@
 /* Update the members of POSTION to the next character boundary.  */
 #define FORWARD_CHAR(POSITION, STOP)					\
   do {									\
+    (POSITION).pos++;							\
     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));		\
+      {									\
+	(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.  */