summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-05-27 04:59:29 +0000
committerRichard M. Stallman <rms@gnu.org>1997-05-27 04:59:29 +0000
commit98136db32ab60663ab450f73e4bf1c3fa12cb2fc (patch)
tree45fb44e0f934d1f4e5f5ce7c66ff267d5328d8ca
parent098401cfa2769a1be43535cbb401cfff2de036b5 (diff)
downloademacs-98136db32ab60663ab450f73e4bf1c3fa12cb2fc.tar.gz
(compute_motion): Return correctly if skip_invisible
takes us past TO.
-rw-r--r--src/indent.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/indent.c b/src/indent.c
index 507b8e36cbe..66392353828 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -997,6 +997,8 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
{
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 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
(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 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
}
}
+ after_loop:
+
/* Remember any final width run in the cache. */
if (current_buffer->width_run_cache
&& width_run_width == 1