]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #6540 with a crash while inserting non-ASCII text under cache-long-line-scans.
authorEli Zaretskii <eliz@gnu.org>
Sat, 7 Jan 2012 11:57:48 +0000 (13:57 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 7 Jan 2012 11:57:48 +0000 (13:57 +0200)
 src/search.c (scan_buffer): Pass character positions to
 know_region_cache, not byte positions.  (Bug#6540)

src/ChangeLog
src/search.c

index 3e0eed38cfbd4ade36eead2bfb96c9c85734e8e4..f7acc826a499aa63e0adfed4f00ecc607b09c0c6 100644 (file)
@@ -1,3 +1,8 @@
+2012-01-07  Eli Zaretskii  <eliz@gnu.org>
+
+       * search.c (scan_buffer): Pass character positions to
+       know_region_cache, not byte positions.  (Bug#6540)
+
 2012-01-07  LynX  <_LynX@bk.ru>  (tiny change)
 
        * w32.c (sys_rename): Report EXDEV when rename of a directory
index bb68c89f2433c0f0ea61f7d20690506562706893..67323b3c6e7359342ce19dab55c9168a822dea3c 100644 (file)
@@ -725,8 +725,8 @@ scan_buffer (register int target, EMACS_INT start, EMACS_INT end,
                  the region from start to cursor is free of them. */
               if (target == '\n' && newline_cache)
                 know_region_cache (current_buffer, newline_cache,
-                                   start_byte + scan_start - base,
-                                   start_byte + cursor - base);
+                                   BYTE_TO_CHAR (start_byte + scan_start - base),
+                                   BYTE_TO_CHAR (start_byte + cursor - base));
 
               /* Did we find the target character?  */
               if (cursor < ceiling_addr)
@@ -791,8 +791,8 @@ scan_buffer (register int target, EMACS_INT start, EMACS_INT end,
                  the region from after the cursor to start is free of them.  */
               if (target == '\n' && newline_cache)
                 know_region_cache (current_buffer, newline_cache,
-                                   start_byte + cursor - base,
-                                   start_byte + scan_start - base);
+                                   BYTE_TO_CHAR (start_byte + cursor - base),
+                                   BYTE_TO_CHAR (start_byte + scan_start - base));
 
               /* Did we find the target character?  */
               if (cursor >= ceiling_addr)