diff src/xdisp.c @ 89983:0796fc36c2bd

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-43 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-553 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-557 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-558 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-559 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-561 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-30 Update from CVS
author Miles Bader <miles@gnu.org>
date Tue, 21 Sep 2004 09:34:12 +0000
parents 566253900690 645b4e98b84e
children e23928ac5a97
line wrap: on
line diff
--- a/src/xdisp.c	Sun Sep 19 04:06:19 2004 +0000
+++ b/src/xdisp.c	Tue Sep 21 09:34:12 2004 +0000
@@ -12504,10 +12504,36 @@
       last_text_row = last_reused_text_row = NULL;
 
       while (it.current_y < it.last_visible_y
-	     && IT_CHARPOS (it) < CHARPOS (start)
 	     && !fonts_changed_p)
-	if (display_line (&it))
-	  last_text_row = it.glyph_row - 1;
+	{
+	  /* If we have reached into the characters in the START row,
+	     that means the line boundaries have changed.  So we
+	     can't start copying with the row START.  Maybe it will
+	     work to start copying with the following row.  */
+	  while (IT_CHARPOS (it) > CHARPOS (start))
+	    {
+	      /* Advance to the next row as the "start".  */
+	      start_row++;
+	      start = start_row->start.pos;
+	      /* If there are no more rows to try, or just one, give up.  */
+	      if (start_row == MATRIX_MODE_LINE_ROW (w->current_matrix) - 1
+		  || w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (start_row)
+		  || CHARPOS (start) == ZV)
+		{
+		  clear_glyph_matrix (w->desired_matrix);
+		  return 0;
+		}
+
+	      start_vpos = MATRIX_ROW_VPOS (start_row, w->current_matrix);
+	    }
+	  /* If we have reached alignment,
+	     we can copy the rest of the rows.  */
+	  if (IT_CHARPOS (it) == CHARPOS (start))
+	    break;
+
+	  if (display_line (&it))
+	    last_text_row = it.glyph_row - 1;
+	}
 
       /* A value of current_y < last_visible_y means that we stopped
 	 at the previous window start, which in turn means that we
@@ -12515,12 +12541,12 @@
       if (it.current_y < it.last_visible_y)
 	{
 	  /* IT.vpos always starts from 0; it counts text lines.  */
-	  nrows_scrolled = it.vpos;
+	  nrows_scrolled = it.vpos - (start_row - MATRIX_FIRST_TEXT_ROW (w->current_matrix));
 
 	  /* Find PT if not already found in the lines displayed.  */
 	  if (w->cursor.vpos < 0)
 	    {
-	      int dy = it.current_y - first_row_y;
+	      int dy = it.current_y - start_row->y;
 
 	      row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
 	      row = row_containing_pos (w, PT, row, NULL, dy);
@@ -12540,7 +12566,7 @@
 	     scroll_run_hook will clear the cursor, and use the
 	     current matrix to get the height of the row the cursor is
 	     in.  */
-	  run.current_y = first_row_y;
+	  run.current_y = start_row->y;
 	  run.desired_y = it.current_y;
 	  run.height = it.last_visible_y - it.current_y;
 
@@ -15435,6 +15461,10 @@
 	    Lisp_Object oprops, aelt;
 	    oprops = Ftext_properties_at (make_number (0), elt);
 
+	    /* If the starting string's properties are not what
+	       we want, translate the string.  Also, if the string
+	       is risky, do that anyway.  */
+
 	    if (NILP (Fequal (props, oprops)) || risky)
 	      {
 		/* If the starting string has properties,