changeset 8309:a4dbf8e6c78f

(line-move, next-line): Check last line moved over has a newline, in a way that intangible text does not confuse.
author Richard M. Stallman <rms@gnu.org>
date Sun, 24 Jul 1994 01:10:14 +0000
parents 9c9cbb121c37
children def3ab3a6f01
files lisp/simple.el
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Fri Jul 22 20:43:39 1994 +0000
+++ b/lisp/simple.el	Sun Jul 24 01:10:14 1994 +0000
@@ -1491,8 +1491,8 @@
   (interactive "p")
   (if (and next-line-add-newlines (= arg 1))
       (let ((opoint (point)))
-	(forward-line 1)
-	(if (or (= opoint (point)) (not (eq (preceding-char) ?\n)))
+	(end-of-line)
+	(if (eobp)
 	    (insert ?\n)
 	  (goto-char opoint)
 	  (line-move arg)))
@@ -1542,8 +1542,15 @@
 		9999
 	      (current-column))))
   (if (not (integerp selective-display))
-      (or (and (zerop (forward-line arg))
-	       (bolp))
+      (or (if (> arg 0)
+	      (progn (if (> arg 1) (forward-line (1- arg)))
+		     ;; This way of moving forward ARG lines
+		     ;; verifies that we have a newline after the last one.
+		     ;; It doesn't get confused by intangible text.
+		     (end-of-line)
+		     (zerop (forward-line 1)))
+	    (and (zerop (forward-line arg))
+		 (bolp)))
 	  (signal (if (bobp)
 		      'beginning-of-buffer
 		    'end-of-buffer)