- 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. */
+ /* Check just_this_one as a way of verifying that the
+ window edges have not changed. */
+ if (PT == XFASTINT (w->last_point) && just_this_one)
+ {
+ pos.hpos = last_point_x;
+ pos.vpos = last_point_y;
+ pos.bufpos = PT;
+ }
+ else if (PT > XFASTINT (w->last_point)
+ && XFASTINT (w->last_point) > startp && just_this_one
+ /* We can't use this if point is in the left margin of a
+ hscrolled window, because w->last_point_x has been
+ clipped to the window edges. */
+ && !(last_point_x <= 0 && hscroll))
+ {
+ pos = *compute_motion (XFASTINT (w->last_point),
+ last_point_y, last_point_x, 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);
+ }