changeset 17966:aaa25a87ae3d

(compute_motion): Return correctly if skip_invisible takes us past TO.
author Richard M. Stallman <rms@gnu.org>
date Tue, 27 May 1997 04:59:29 +0000
parents 2ef01cc793bf
children 08bf89d739cd
files src/indent.c
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/indent.c	Tue May 27 03:15:29 1997 +0000
+++ b/src/indent.c	Tue May 27 04:59:29 1997 +0000
@@ -997,6 +997,8 @@
     {
       while (pos == next_boundary)
 	{
+	  int newpos;
+
 	  /* If the caller says that the screen position came from an earlier
 	     call to compute_motion, then we've already accounted for the
 	     overlay strings at point.  This is only true the first time
@@ -1020,7 +1022,12 @@
 	     (but not necessarily all that there are here),
 	     and store in next_boundary the next position where
 	     we need to call skip_invisible.  */
-	  pos = skip_invisible (pos, &next_boundary, to, window);
+	  newpos = skip_invisible (pos, &next_boundary, to, window);
+
+	  if (newpos >= to)
+	    goto after_loop;
+
+	  pos = newpos;
 	}
 
       /* Handle right margin.  */
@@ -1361,6 +1368,8 @@
 	}
     }
 
+ after_loop:
+
   /* Remember any final width run in the cache.  */
   if (current_buffer->width_run_cache
       && width_run_width == 1