changeset 57734:32217d296ff3

(vmotion): When moving up, check the newline before. Make prevline an int, not a Lisp_Object.
author Richard M. Stallman <rms@gnu.org>
date Wed, 27 Oct 2004 10:57:40 +0000
parents bf99e505dd7a
children 82bd283dbbf8
files src/indent.c
diffstat 1 files changed, 25 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/src/indent.c	Wed Oct 27 10:27:46 2004 +0000
+++ b/src/indent.c	Wed Oct 27 10:57:40 2004 +0000
@@ -1883,7 +1883,7 @@
   struct position pos;
   /* vpos is cumulative vertical position, changed as from is changed */
   register int vpos = 0;
-  Lisp_Object prevline;
+  int prevline;
   register int first;
   int from_byte;
   int lmargin = hscroll > 0 ? 1 - hscroll : 0;
@@ -1917,23 +1917,21 @@
 	{
 	  Lisp_Object propval;
 
-	  XSETFASTINT (prevline, find_next_newline_no_quit (from - 1, -1));
-	  while (XFASTINT (prevline) > BEGV
+	  prevline = find_next_newline_no_quit (from - 1, -1);
+	  while (prevline > BEGV
 		 && ((selective > 0
-		      && indented_beyond_p (XFASTINT (prevline),
-					    CHAR_TO_BYTE (XFASTINT (prevline)),
+		      && indented_beyond_p (prevline,
+					    CHAR_TO_BYTE (prevline),
 					    (double) selective)) /* iftc */
-		     /* watch out for newlines with `invisible' property */
-		     || (propval = Fget_char_property (prevline,
+		     /* Watch out for newlines with `invisible' property.
+			When moving upward, check the newline before.  */
+		     || (propval = Fget_char_property (make_number (prevline - 1),
 						       Qinvisible,
 						       text_prop_object),
 			 TEXT_PROP_MEANS_INVISIBLE (propval))))
-	    XSETFASTINT (prevline,
-			 find_next_newline_no_quit (XFASTINT (prevline) - 1,
-						    -1));
-	  pos = *compute_motion (XFASTINT (prevline), 0,
-				 lmargin + (XFASTINT (prevline) == BEG
-					    ? start_hpos : 0),
+	    prevline = find_next_newline_no_quit (prevline - 1, -1);
+	  pos = *compute_motion (prevline, 0,
+				 lmargin + (prevline == BEG ? start_hpos : 0),
 				 0,
 				 from,
 				 /* Don't care for VPOS...  */
@@ -1944,12 +1942,11 @@
 				 /* This compensates for start_hpos
 				    so that a tab as first character
 				    still occupies 8 columns.  */
-				 (XFASTINT (prevline) == BEG
-				  ? -start_hpos : 0),
+				 (prevline == BEG ? -start_hpos : 0),
 				 w);
 	  vpos -= pos.vpos;
 	  first = 0;
-	  from = XFASTINT (prevline);
+	  from = prevline;
 	}
 
       /* If we made exactly the desired vertical distance,
@@ -1977,21 +1974,21 @@
     {
       Lisp_Object propval;
 
-      XSETFASTINT (prevline, find_next_newline_no_quit (from, -1));
-      while (XFASTINT (prevline) > BEGV
+      prevline = find_next_newline_no_quit (from, -1);
+      while (prevline > BEGV
 	     && ((selective > 0
-		  && indented_beyond_p (XFASTINT (prevline),
-					CHAR_TO_BYTE (XFASTINT (prevline)),
+		  && indented_beyond_p (prevline,
+					CHAR_TO_BYTE (prevline),
 					(double) selective)) /* iftc */
-		 /* watch out for newlines with `invisible' property */
-		 || (propval = Fget_char_property (prevline, Qinvisible,
+		 /* Watch out for newlines with `invisible' property.
+		    When moving downward, check the newline after.  */
+		 || (propval = Fget_char_property (make_number (prevline),
+						   Qinvisible,
 						   text_prop_object),
 		     TEXT_PROP_MEANS_INVISIBLE (propval))))
-	XSETFASTINT (prevline,
-		     find_next_newline_no_quit (XFASTINT (prevline) - 1,
-						-1));
-      pos = *compute_motion (XFASTINT (prevline), 0,
-			     lmargin + (XFASTINT (prevline) == BEG
+	prevline = find_next_newline_no_quit (prevline - 1, -1);
+      pos = *compute_motion (prevline, 0,
+			     lmargin + (prevline == BEG
 					? start_hpos : 0),
 			     0,
 			     from,
@@ -2000,7 +1997,7 @@
 			     /* ... nor HPOS.  */
 			     1 << (BITS_PER_SHORT - 1),
 			     -1, hscroll,
-			     (XFASTINT (prevline) == BEG ? -start_hpos : 0),
+			     (prevline == BEG ? -start_hpos : 0),
 			     w);
       did_motion = 1;
     }