]> code.delx.au - gnu-emacs/commitdiff
(forward_to_next_line_start): Avoid calling
authorGerd Moellmann <gerd@gnu.org>
Wed, 17 Jan 2001 20:11:33 +0000 (20:11 +0000)
committerGerd Moellmann <gerd@gnu.org>
Wed, 17 Jan 2001 20:11:33 +0000 (20:11 +0000)
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.

src/ChangeLog
src/xdisp.c

index 40404210f87b93f516dd885a3c674d901a98f325..52319b2c352c40324a158f1a8ef63ddd55f81df8 100644 (file)
@@ -1,5 +1,10 @@
 2001-01-17  Gerd Moellmann  <gerd@gnu.org>
 
+       * xdisp.c (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.
+
        * dispnew.c (direct_output_for_insert): If char_ins_del_ok is
        zero, use this method only at the end of a line.
 
index bdbef8a11438c97ca36546d6bcbf55da6b3350f3..00e325b325151dd05c74851d245f28d4a2d4fb5a 100644 (file)
@@ -3507,20 +3507,18 @@ forward_to_next_line_start (it, skipped_p)
 
   /* 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);