Mercurial > emacs
comparison src/xdisp.c @ 35379:4bdad7b6d6dc
(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.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Wed, 17 Jan 2001 20:11:05 +0000 |
parents | 1b5e3bc8ce89 |
children | 1ad9046911a2 |
comparison
equal
deleted
inserted
replaced
35378:1ae53bd2e777 | 35379:4bdad7b6d6dc |
---|---|
3505 old_selective = it->selective; | 3505 old_selective = it->selective; |
3506 it->selective = 0; | 3506 it->selective = 0; |
3507 | 3507 |
3508 /* Scan for a newline within MAX_NEWLINE_DISTANCE display elements | 3508 /* Scan for a newline within MAX_NEWLINE_DISTANCE display elements |
3509 from buffer text. */ | 3509 from buffer text. */ |
3510 n = newline_found_p = 0; | 3510 for (n = newline_found_p = 0; |
3511 while (n < MAX_NEWLINE_DISTANCE | 3511 !newline_found_p && n < MAX_NEWLINE_DISTANCE; |
3512 && get_next_display_element (it) | 3512 n += STRINGP (it->string) ? 0 : 1) |
3513 && !newline_found_p) | 3513 { |
3514 { | 3514 get_next_display_element (it); |
3515 newline_found_p = it->what == IT_CHARACTER && it->c == '\n'; | 3515 newline_found_p = it->what == IT_CHARACTER && it->c == '\n'; |
3516 set_iterator_to_next (it, 0); | 3516 set_iterator_to_next (it, 0); |
3517 if (!STRINGP (it->string)) | |
3518 ++n; | |
3519 } | 3517 } |
3520 | 3518 |
3521 /* If we didn't find a newline near enough, see if we can use a | 3519 /* If we didn't find a newline near enough, see if we can use a |
3522 short-cut. */ | 3520 short-cut. */ |
3523 if (!newline_found_p && n == MAX_NEWLINE_DISTANCE) | 3521 if (n == MAX_NEWLINE_DISTANCE) |
3524 { | 3522 { |
3525 int start = IT_CHARPOS (*it); | 3523 int start = IT_CHARPOS (*it); |
3526 int limit = find_next_newline_no_quit (start, 1); | 3524 int limit = find_next_newline_no_quit (start, 1); |
3527 Lisp_Object pos; | 3525 Lisp_Object pos; |
3528 | 3526 |