# HG changeset patch # User Gerd Moellmann # Date 979762265 0 # Node ID 4bdad7b6d6dc10522b0ca6ef9687bdb45792ab3d # Parent 1ae53bd2e777bb977e397ce9f09e1f72e9d95a4c (forward_to_next_line_start): Avoid calling get_next_display_element when the newline is already found. This may change the iterator's position, when its current position is equal to the iterator's stop_charpos. diff -r 1ae53bd2e777 -r 4bdad7b6d6dc src/xdisp.c --- a/src/xdisp.c Wed Jan 17 18:34:29 2001 +0000 +++ b/src/xdisp.c Wed Jan 17 20:11:05 2001 +0000 @@ -3507,20 +3507,18 @@ /* Scan for a newline within MAX_NEWLINE_DISTANCE display elements from buffer text. */ - n = newline_found_p = 0; - while (n < MAX_NEWLINE_DISTANCE - && get_next_display_element (it) - && !newline_found_p) - { + for (n = newline_found_p = 0; + !newline_found_p && n < MAX_NEWLINE_DISTANCE; + n += STRINGP (it->string) ? 0 : 1) + { + get_next_display_element (it); newline_found_p = it->what == IT_CHARACTER && it->c == '\n'; set_iterator_to_next (it, 0); - if (!STRINGP (it->string)) - ++n; } /* If we didn't find a newline near enough, see if we can use a short-cut. */ - if (!newline_found_p && n == MAX_NEWLINE_DISTANCE) + if (n == MAX_NEWLINE_DISTANCE) { int start = IT_CHARPOS (*it); int limit = find_next_newline_no_quit (start, 1);