changeset 21011:ceb05db73a63

(update_syntax_table): Properly update `position' field of used intervals.
author Richard M. Stallman <rms@gnu.org>
date Mon, 02 Mar 1998 02:40:53 +0000
parents ba03aa5d64d6
children 22c48e547cb0
files src/syntax.c
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/syntax.c	Sun Mar 01 23:17:19 1998 +0000
+++ b/src/syntax.c	Mon Mar 02 02:40:53 1998 +0000
@@ -130,6 +130,21 @@
       invalidate = 0;
       if (NULL_INTERVAL_P (i))
 	return;
+      /* interval_of () updates only ->position of the return value,
+	 update the parents manually to speed up update_interval.  */
+      while (!NULL_PARENT (i)) 
+	{
+	  if (AM_RIGHT_CHILD (i))
+	    i->parent->position = i->position
+	      - LEFT_TOTAL_LENGTH (i) + TOTAL_LENGTH (i) /* right end */
+	      - TOTAL_LENGTH (i->parent)
+	      + LEFT_TOTAL_LENGTH (i->parent);
+	  else
+	    i->parent->position = i->position - LEFT_TOTAL_LENGTH (i)
+	      + TOTAL_LENGTH (i);
+	  i = i->parent;
+	}
+      i = gl_state.forward_i;
       gl_state.b_property = i->position - 1 - gl_state.offset;
       gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset;
       goto update;