* src/xdisp.c (redisplay_window): Use BEG rather than hard coding 1

This commit is contained in:
Stefan Monnier 2022-08-02 10:38:53 -04:00
parent 344b48f490
commit 8783700b23
2 changed files with 4 additions and 3 deletions

View file

@ -214,11 +214,12 @@ buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos)
We have one known above and one known below.
Scan, counting characters, from whichever one is closer. */
eassert (best_below <= charpos && charpos <= best_above);
if (charpos - best_below < best_above - charpos)
{
bool record = charpos - best_below > 5000;
while (best_below != charpos)
while (best_below < charpos)
{
best_below++;
best_below_byte += buf_next_char_len (b, best_below_byte);
@ -243,7 +244,7 @@ buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos)
{
bool record = best_above - charpos > 5000;
while (best_above != charpos)
while (best_above > charpos)
{
best_above--;
best_above_byte -= buf_prev_char_len (b, best_above_byte);

View file

@ -19449,7 +19449,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
{
ptrdiff_t cur, next, found, max = 0, threshold;
threshold = XFIXNUM (Vlong_line_threshold);
for (cur = 1; cur < Z; cur = next)
for (cur = BEG; cur < Z; cur = next)
{
next = find_newline1 (cur, CHAR_TO_BYTE (cur), 0, -1, 1,
&found, NULL, true);