emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115052: Fix bug #15841 with missing line numbers in


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r115052: Fix bug #15841 with missing line numbers in linum-mode.
Date: Sat, 09 Nov 2013 21:25:05 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115052
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/15841
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2013-11-09 23:24:10 +0200
message:
  Fix bug #15841 with missing line numbers in linum-mode.
  
   src/search.c (find_newline): If buffer text is relocated during the
   "dumb loop", adjust C pointers into buffer text to follow suit.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/search.c                   search.c-20091113204419-o5vbwnq5f7feedwu-473
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-11-09 11:19:53 +0000
+++ b/src/ChangeLog     2013-11-09 21:24:10 +0000
@@ -1,3 +1,9 @@
+2013-11-09  Eli Zaretskii  <address@hidden>
+
+       * search.c (find_newline): If buffer text is relocated during the
+       "dumb loop", adjust C pointers into buffer text to follow suit.
+       (Bug#15841)
+
 2013-11-09  Ɓukasz Stelmach <address@hidden> (tiny change)
 
        * gtkutil.c (xg_check_special_colors): Use rgb: instead of rgbi:

=== modified file 'src/search.c'
--- a/src/search.c      2013-08-29 07:03:18 +0000
+++ b/src/search.c      2013-11-09 21:24:10 +0000
@@ -752,6 +752,22 @@
                    *bytepos = nl + 1 - base + start_byte;
                  return BYTE_TO_CHAR (nl + 1 - base + start_byte);
                }
+             if (newline_cache)
+               {
+                 /* The call to know_region_cache could have
+                    allocated memory and caused relocation of buffer
+                    text.  If it did, adjust pointers into buffer
+                    text.  */
+                 ptrdiff_t offset = BYTE_POS_ADDR (start_byte) - base;
+
+                 if (offset != 0)
+                   {
+                     cursor += offset;
+                     base += offset;
+                     ceiling_addr += offset;
+                     nl += offset;
+                   }
+               }
              cursor = nl + 1;
             }
 
@@ -824,6 +840,18 @@
                    *bytepos = nl - base + start_byte;
                  return BYTE_TO_CHAR (nl - base + start_byte);
                }
+             if (newline_cache)
+               {
+                 ptrdiff_t offset = BYTE_POS_ADDR (start_byte - 1) - base;
+
+                 if (offset != 0)
+                   {
+                     cursor += offset;
+                     base += offset;
+                     ceiling_addr += offset;
+                     nl += offset;
+                   }
+               }
              cursor = nl - 1;
             }
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]