diff src/xdisp.c @ 6622:1253ece9950b

(redisplay): In previous change, handle case where no newline follows.
author Richard M. Stallman <rms@gnu.org>
date Fri, 01 Apr 1994 08:19:19 +0000
parents b3631c88ec7e
children c359dfd21b00
line wrap: on
line diff
--- a/src/xdisp.c	Fri Apr 01 02:31:45 1994 +0000
+++ b/src/xdisp.c	Fri Apr 01 08:19:19 1994 +0000
@@ -626,8 +626,18 @@
 	      int left = XFASTINT (w->left);
 	      int *charstart_next_line
 		= FRAME_CURRENT_GLYPHS (XFRAME (WINDOW_FRAME (w)))->charstarts[this_line_vpos + 1];
-	      int adjust = Z - tlendpos + 1 - charstart_next_line[left];
 	      int i;
+	      int adjust;
+
+	      if (Z - tlendpos == ZV)
+		/* This line ends at end of (accessible part of) buffer.
+		   There is no newline to count.  */
+		adjust = Z - tlendpos - charstart_next_line[left];
+	      else
+		/* This line ends in a newline.
+		   Must take account of the newline and the rest of the
+		   text that follows.  */
+		adjust = Z - tlendpos + 1 - charstart_next_line[left];
 
 	      adjust_window_charstarts (w, this_line_vpos, adjust);