changeset 25028:ab513f624bc6

(Fvertical_motion): Rewritten.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 21 Jul 1999 21:43:52 +0000
parents f36ec150350e
children dc975d71a3a5
files src/indent.c
diffstat 1 files changed, 26 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/indent.c	Wed Jul 21 21:43:52 1999 +0000
+++ b/src/indent.c	Wed Jul 21 21:43:52 1999 +0000
@@ -203,7 +203,7 @@
    characters immediately following, then *NEXT_BOUNDARY_P
    will equal the return value.  */
 
-static int
+int
 skip_invisible (pos, next_boundary_p, to, window)
      int pos;
      int *next_boundary_p;
@@ -1518,6 +1518,7 @@
   return &val_compute_motion;
 }
 
+
 #if 0 /* The doc string is too long for some compilers,
 	 but make-docfile can find it in this comment.  */
 DEFUN ("compute-motion", Ffoo, Sfoo, 7, 7, 0,
@@ -1814,7 +1815,10 @@
   (lines, window)
      Lisp_Object lines, window;
 {
-  struct position pos;
+  struct it it;
+  struct text_pos pt;
+  struct buffer *old, *b;
+  struct window *w;
 
   CHECK_NUMBER (lines, 0);
   if (! NILP (window))
@@ -1822,11 +1826,28 @@
   else
     window = selected_window;
 
-  pos = *vmotion (PT, (int) XINT (lines), XWINDOW (window));
+  w = XWINDOW (window);
+  b = XBUFFER (w->buffer);
+  if (b != current_buffer)
+    {
+      old = current_buffer;
+      set_buffer_internal_1 (b);
+    }
+  else
+    old = NULL;
+      
+  SET_TEXT_POS (pt, PT, PT_BYTE);
+  start_display (&it, w, pt);
+  move_it_by_lines (&it, XINT (lines), 0);
+  SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
 
-  SET_PT (pos.bufpos);
-  return make_number (pos.vpos);
+  if (old)
+    set_buffer_internal_1 (old);
+  
+  return make_number (it.vpos);
 }
+
+
 
 /* file's initialization.  */