]> git.eshelyaron.com Git - emacs.git/commitdiff
(redisplay_window): When text has not changed,
authorRichard M. Stallman <rms@gnu.org>
Mon, 28 Jul 1997 04:55:45 +0000 (04:55 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 28 Jul 1997 04:55:45 +0000 (04:55 +0000)
call compute_motion starting from the former PT if possible.
If PT is unchanged from w->last_point, don't do compute_motion at all.

src/xdisp.c

index 9d88cff44b851892bd33ba888e37626fabd9bc65..d0fa8a16e39e0e8b30c277e375cceddfddd3e363 100644 (file)
@@ -1839,13 +1839,37 @@ redisplay_window (window, just_this_one, preserve_echo_area)
     {
       int this_scroll_margin = scroll_margin;
 
-      pos = *compute_motion (startp, 0, (hscroll ? 1 - hscroll : 0), 0,
-                            PT, height,
-                            /* BUG FIX: See the comment of
-                                Fpos_visible_in_window_p (window.c).  */
-                            - (1 << (BITS_PER_SHORT - 1)),
-                            width, hscroll,
-                            pos_tab_offset (w, startp), w);
+      /* Find where PT is located now on the frame.  */
+      if (PT == w->last_point)
+       {
+         pos.hpos = (w->last_point_x
+                     + (hscroll ? 1 - hscroll : 0)
+                     - WINDOW_LEFT_MARGIN (w));
+         pos.vpos = w->last_point_y;
+         pos.bufpos = PT;
+       }
+      else if (PT > w->last_point)
+       {
+         pos = *compute_motion (w->last_point, w->last_point_y,
+                                w->last_point_x + (hscroll ? 1 - hscroll : 0),
+                                0,
+                                PT, height,
+                                /* BUG FIX: See the comment of
+                                   Fpos_visible_in_window_p (window.c).  */
+                                - (1 << (BITS_PER_SHORT - 1)),
+                                width, hscroll,
+                                pos_tab_offset (w, startp), w);
+       }
+      else
+       {
+         pos = *compute_motion (startp, 0, (hscroll ? 1 - hscroll : 0), 0,
+                                PT, height,
+                                /* BUG FIX: See the comment of
+                                   Fpos_visible_in_window_p (window.c).  */
+                                - (1 << (BITS_PER_SHORT - 1)),
+                                width, hscroll,
+                                pos_tab_offset (w, startp), w);
+       }
 
       /* Don't use a scroll margin that is negative or too large.  */
       if (this_scroll_margin < 0)