]> git.eshelyaron.com Git - emacs.git/commitdiff
(update_syntax_table): Properly update `position' field of used intervals.
authorRichard M. Stallman <rms@gnu.org>
Mon, 2 Mar 1998 02:40:53 +0000 (02:40 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 2 Mar 1998 02:40:53 +0000 (02:40 +0000)
src/syntax.c

index 1b05ed572047daa40c5b055c6dd3a9f993984afc..4ac1c8d1b830370eaa87dd9555af730fdd709e85 100644 (file)
@@ -130,6 +130,21 @@ update_syntax_table (charpos, count, init, object)
       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;