Commit aed328bf authored by Kim F. Storm's avatar Kim F. Storm
Browse files

(window_scroll_pixel_based): When scrolling backwards,

handle partial visible line at end of window even when we hit PT.
parent 81c85b53
...@@ -4763,6 +4763,7 @@ window_scroll_pixel_based (window, n, whole, noerror) ...@@ -4763,6 +4763,7 @@ window_scroll_pixel_based (window, n, whole, noerror)
else if (n < 0) else if (n < 0)
{ {
int charpos, bytepos; int charpos, bytepos;
int partial_p;
/* Save our position, for the preserve_y case. */ /* Save our position, for the preserve_y case. */
charpos = IT_CHARPOS (it); charpos = IT_CHARPOS (it);
...@@ -4774,7 +4775,20 @@ window_scroll_pixel_based (window, n, whole, noerror) ...@@ -4774,7 +4775,20 @@ window_scroll_pixel_based (window, n, whole, noerror)
it.last_visible_y - this_scroll_margin - 1, -1, it.last_visible_y - this_scroll_margin - 1, -1,
MOVE_TO_POS | MOVE_TO_Y); MOVE_TO_POS | MOVE_TO_Y);
if (IT_CHARPOS (it) == PT) /* Save our position, in case it's correct. */
charpos = IT_CHARPOS (it);
bytepos = IT_BYTEPOS (it);
/* See if point is on a partially visible line at the end. */
if (it.what == IT_EOB)
partial_p = it.current_y + it.ascent + it.descent > it.last_visible_y;
else
{
move_it_by_lines (&it, 1, 1);
partial_p = it.current_y > it.last_visible_y;
}
if (charpos == PT && !partial_p)
/* We found PT before we found the display margin, so PT is ok. */ /* We found PT before we found the display margin, so PT is ok. */
; ;
else if (preserve_y >= 0) else if (preserve_y >= 0)
...@@ -4795,14 +4809,7 @@ window_scroll_pixel_based (window, n, whole, noerror) ...@@ -4795,14 +4809,7 @@ window_scroll_pixel_based (window, n, whole, noerror)
} }
else else
{ {
/* Save our position, in case it's correct. */ if (partial_p)
charpos = IT_CHARPOS (it);
bytepos = IT_BYTEPOS (it);
/* See if point is on a partially visible line at the end. */
move_it_by_lines (&it, 1, 1);
if (it.current_y > it.last_visible_y)
/* The last line was only partially visible, so back up two /* The last line was only partially visible, so back up two
lines to make sure we're on a fully visible line. */ lines to make sure we're on a fully visible line. */
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment