Subject: Re: bug#14780: Regression: C-n doesn't go to next line under simple circumstances

From: Eli Zaretskii <[email-masked]>
Date: Sat, 20 Jul 2013 12:09:32 +0300

> Date: Sat, 20 Jul 2013 11:33:07 +0300
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked]
> 
> Does the following fix the problem for you?

Sorry, that change had a bug.  Please try this instead:

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2013-07-16 21:35:45 +0000
+++ src/xdisp.c	2013-07-20 09:05:11 +0000
@@ -15608,10 +15608,11 @@ redisplay_window (Lisp_Object window, in
 	     the Y coordinate of the _next_ row, see the definition of
 	     MATRIX_ROW_BOTTOM_Y.  */
 	  if (w->cursor.vpos < margin + header_line)
-	    new_vpos
-	      = pixel_margin + (header_line
-				? CURRENT_HEADER_LINE_HEIGHT (w)
-				: 0) + frame_line_height;
+	    {
+	      w->cursor.vpos = -1;
+	      clear_glyph_matrix (w->desired_matrix);
+	      goto try_to_scroll;
+	    }
 	  else
 	    {
 	      int window_height = window_box_height (w);
@@ -15619,7 +15620,11 @@ redisplay_window (Lisp_Object window, in
 	      if (header_line)
 		window_height += CURRENT_HEADER_LINE_HEIGHT (w);
 	      if (w->cursor.y >= window_height - pixel_margin)
-		new_vpos = window_height - pixel_margin;
+		{
+		  w->cursor.vpos = -1;
+		  clear_glyph_matrix (w->desired_matrix);
+		  goto try_to_scroll;
+		}
 	    }
 	}