changeset 26265:bcd25953e4cf

(end-of-buffer): Use window-end to find the window end instead of vertical-motion because this handles variable-height lines correctly.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 01 Nov 1999 11:39:20 +0000
parents cae8531d2565
children ac47277769f8
files lisp/simple.el
diffstat 1 files changed, 6 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Mon Nov 01 11:07:32 1999 +0000
+++ b/lisp/simple.el	Mon Nov 01 11:39:20 1999 +0000
@@ -379,17 +379,12 @@
 		 (point-max))))
   ;; If we went to a place in the middle of the buffer,
   ;; adjust it to the beginning of a line.
-  (if arg (forward-line 1)
-    ;; If the end of the buffer is not already on the screen,
-    ;; then scroll specially to put it near, but not at, the bottom.
-    (if (let ((old-point (point)))
-	  (save-excursion
-		    (goto-char (window-start))
-		    (vertical-motion (window-height))
-		    (< (point) old-point)))
-	(progn
-	  (overlay-recenter (point))
-	  (recenter -3)))))
+  (cond (arg (forward-line 1))
+	((< (point) (window-end nil t))
+	 ;; If the end of the buffer is not already on the screen,
+	 ;; then scroll specially to put it near, but not at, the bottom.
+	 (overlay-recenter (point))
+	 (recenter -3))))
 
 (defun mark-whole-buffer ()
   "Put point at beginning and mark at end of buffer.