aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2013-11-09 23:24:10 +0200
committerEli Zaretskii2013-11-09 23:24:10 +0200
commit85f37d101104e812c545d6ae9275508bc20c8fe1 (patch)
treef26da8e8e40c24fc53070acf13de3eec8bae6077 /src
parentb24ac90f5d01e4999b9571ce3a51e8797859c193 (diff)
downloademacs-85f37d101104e812c545d6ae9275508bc20c8fe1.tar.gz
emacs-85f37d101104e812c545d6ae9275508bc20c8fe1.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/search.c28
2 files changed, 34 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5ff279a4400..9a485533266 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12013-11-09 Eli Zaretskii <eliz@gnu.org>
2
3 * search.c (find_newline): If buffer text is relocated during the
4 "dumb loop", adjust C pointers into buffer text to follow suit.
5 (Bug#15841)
6
12013-11-09 Łukasz Stelmach <stlman@poczta.fm> (tiny change) 72013-11-09 Łukasz Stelmach <stlman@poczta.fm> (tiny change)
2 8
3 * gtkutil.c (xg_check_special_colors): Use rgb: instead of rgbi: 9 * gtkutil.c (xg_check_special_colors): Use rgb: instead of rgbi:
diff --git a/src/search.c b/src/search.c
index 99e8d2501fe..1d0740428d7 100644
--- a/src/search.c
+++ b/src/search.c
@@ -752,6 +752,22 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, ptrdiff_t end,
752 *bytepos = nl + 1 - base + start_byte; 752 *bytepos = nl + 1 - base + start_byte;
753 return BYTE_TO_CHAR (nl + 1 - base + start_byte); 753 return BYTE_TO_CHAR (nl + 1 - base + start_byte);
754 } 754 }
755 if (newline_cache)
756 {
757 /* The call to know_region_cache could have
758 allocated memory and caused relocation of buffer
759 text. If it did, adjust pointers into buffer
760 text. */
761 ptrdiff_t offset = BYTE_POS_ADDR (start_byte) - base;
762
763 if (offset != 0)
764 {
765 cursor += offset;
766 base += offset;
767 ceiling_addr += offset;
768 nl += offset;
769 }
770 }
755 cursor = nl + 1; 771 cursor = nl + 1;
756 } 772 }
757 773
@@ -824,6 +840,18 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, ptrdiff_t end,
824 *bytepos = nl - base + start_byte; 840 *bytepos = nl - base + start_byte;
825 return BYTE_TO_CHAR (nl - base + start_byte); 841 return BYTE_TO_CHAR (nl - base + start_byte);
826 } 842 }
843 if (newline_cache)
844 {
845 ptrdiff_t offset = BYTE_POS_ADDR (start_byte - 1) - base;
846
847 if (offset != 0)
848 {
849 cursor += offset;
850 base += offset;
851 ceiling_addr += offset;
852 nl += offset;
853 }
854 }
827 cursor = nl - 1; 855 cursor = nl - 1;
828 } 856 }
829 857