]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #17269 with corruption of the newline cache.
authorEli Zaretskii <eliz@gnu.org>
Thu, 17 Apr 2014 07:24:40 +0000 (10:24 +0300)
committerEli Zaretskii <eliz@gnu.org>
Thu, 17 Apr 2014 07:24:40 +0000 (10:24 +0300)
 src/insdel.c (invalidate_buffer_caches): Invalidate the bidi
 paragraph-start cache before the newline cache.

src/ChangeLog
src/insdel.c

index 84760abd0192aa64965b8a9d4e2a1fa391184b50..d0aa2e59e0197583162381776b23b6fc57b1798c 100644 (file)
@@ -1,3 +1,8 @@
+2014-04-17  Eli Zaretskii  <eliz@gnu.org>
+
+       * insdel.c (invalidate_buffer_caches): Invalidate the bidi
+       paragraph-start cache before the newline cache.  (Bug#17269)
+
 2014-04-16  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * window.c (save_window_save): Lookup window_point_insertion_type in
index ea5f63015017b38140a2652421de801aa0e29cca..85526d46db1e240b9ac6976fbbd573b270581567 100644 (file)
@@ -1857,14 +1857,9 @@ invalidate_buffer_caches (struct buffer *buf, ptrdiff_t start, ptrdiff_t end)
      need to consider the caches of their base buffer.  */
   if (buf->base_buffer)
     buf = buf->base_buffer;
-  if (buf->newline_cache)
-    invalidate_region_cache (buf,
-                             buf->newline_cache,
-                             start - BUF_BEG (buf), BUF_Z (buf) - end);
-  if (buf->width_run_cache)
-    invalidate_region_cache (buf,
-                             buf->width_run_cache,
-                             start - BUF_BEG (buf), BUF_Z (buf) - end);
+  /* The bidi_paragraph_cache must be invalidated first, because doing
+     so might need to use the newline_cache (via find_newline_no_quit,
+     see below).  */
   if (buf->bidi_paragraph_cache)
     {
       if (start != end
@@ -1888,13 +1883,20 @@ invalidate_buffer_caches (struct buffer *buf, ptrdiff_t start, ptrdiff_t end)
                                               &start_byte);
              set_buffer_internal (old);
            }
-         if (line_beg > BUF_BEG (buf))
-           start = line_beg - 1;
+         start = line_beg - (line_beg > BUF_BEG (buf));
        }
       invalidate_region_cache (buf,
                               buf->bidi_paragraph_cache,
                               start - BUF_BEG (buf), BUF_Z (buf) - end);
     }
+  if (buf->newline_cache)
+    invalidate_region_cache (buf,
+                             buf->newline_cache,
+                             start - BUF_BEG (buf), BUF_Z (buf) - end);
+  if (buf->width_run_cache)
+    invalidate_region_cache (buf,
+                             buf->width_run_cache,
+                             start - BUF_BEG (buf), BUF_Z (buf) - end);
 }
 
 /* These macros work with an argument named `preserve_ptr'