comparison src/syntax.c @ 37532:f14973be41f5

(update_syntax_table): Check that oldi has the same properties as old_prop before deciding not to invalidate.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 01 May 2001 13:49:44 +0000
parents 945b3e6bf3e7
children 46bbf160c47f
comparison
equal deleted inserted replaced
37531:e71362bfa695 37532:f14973be41f5
160 gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset; 160 gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset;
161 goto update; 161 goto update;
162 } 162 }
163 oldi = i = count > 0 ? gl_state.forward_i : gl_state.backward_i; 163 oldi = i = count > 0 ? gl_state.forward_i : gl_state.backward_i;
164 164
165 /* We are guarantied to be called with CHARPOS either in i, 165 /* We are guaranteed to be called with CHARPOS either in i,
166 or further off. */ 166 or further off. */
167 if (NULL_INTERVAL_P (i)) 167 if (NULL_INTERVAL_P (i))
168 error ("Error in syntax_table logic for to-the-end intervals"); 168 error ("Error in syntax_table logic for to-the-end intervals");
169 else if (charpos < i->position) /* Move left. */ 169 else if (charpos < i->position) /* Move left. */
170 { 170 {
171 if (count > 0) 171 if (count > 0)
172 error ("Error in syntax_table logic for intervals <-"); 172 error ("Error in syntax_table logic for intervals <-");
173 /* Update the interval. */ 173 /* Update the interval. */
174 i = update_interval (i, charpos); 174 i = update_interval (i, charpos);
175 if (oldi->position != INTERVAL_LAST_POS (i)) 175 if (!gl_state.left_ok || oldi->position != INTERVAL_LAST_POS (i))
176 { 176 {
177 invalidate = 0; 177 invalidate = 0;
178 gl_state.right_ok = 1; /* Invalidate the other end. */ 178 gl_state.right_ok = 1; /* Invalidate the other end. */
179 gl_state.forward_i = i; 179 gl_state.forward_i = i;
180 gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset; 180 gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset;
181 } 181 }
182 } 182 }
183 else if (charpos >= INTERVAL_LAST_POS (i)) /* Move right. */ 183 else if (charpos >= INTERVAL_LAST_POS (i)) /* Move right. */
184 { 184 {
185 if (count < 0) 185 if (count < 0)
186 error ("Error in syntax_table logic for intervals ->"); 186 error ("Error in syntax_table logic for intervals ->");
187 /* Update the interval. */ 187 /* Update the interval. */
188 i = update_interval (i, charpos); 188 i = update_interval (i, charpos);
189 if (i->position != INTERVAL_LAST_POS (oldi)) 189 if (!gl_state.right_ok || i->position != INTERVAL_LAST_POS (oldi))
190 { 190 {
191 invalidate = 0; 191 invalidate = 0;
192 gl_state.left_ok = 1; /* Invalidate the other end. */ 192 gl_state.left_ok = 1; /* Invalidate the other end. */
193 gl_state.backward_i = i; 193 gl_state.backward_i = i;
194 gl_state.b_property = i->position - 1 - gl_state.offset; 194 gl_state.b_property = i->position - 1 - gl_state.offset;
204 tmp_table = textget (i->plist, Qsyntax_table); 204 tmp_table = textget (i->plist, Qsyntax_table);
205 205
206 if (invalidate) 206 if (invalidate)
207 invalidate = !EQ (tmp_table, gl_state.old_prop); /* Need to invalidate? */ 207 invalidate = !EQ (tmp_table, gl_state.old_prop); /* Need to invalidate? */
208 208
209 if (invalidate) /* Did not get to adjacent interval. */ 209 if (invalidate) /* Did not get to adjacent interval. */
210 { /* with the same table => */ 210 { /* with the same table => */
211 /* invalidate the old range. */ 211 /* invalidate the old range. */
212 if (count > 0) 212 if (count > 0)
213 { 213 {
214 gl_state.backward_i = i; 214 gl_state.backward_i = i;
215 gl_state.left_ok = 1; /* Invalidate the other end. */ 215 gl_state.left_ok = 1; /* Invalidate the other end. */
216 gl_state.b_property = i->position - 1 - gl_state.offset; 216 gl_state.b_property = i->position - 1 - gl_state.offset;