Commit 85f37d10 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

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.
parent b24ac90f
2013-11-09 Eli Zaretskii <eliz@gnu.org>
* 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 <stlman@poczta.fm> (tiny change)
* gtkutil.c (xg_check_special_colors): Use rgb: instead of rgbi:
......
......@@ -752,6 +752,22 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, ptrdiff_t end,
*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 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, ptrdiff_t end,
*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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment