# HG changeset patch # User Gerd Moellmann # Date 1008164575 0 # Node ID c8338f001d95ee1a3b910683f1c3b6a71019aab6 # Parent 8fb314e3c7fd9d602695310067817d65214c2cda (move_it_vertically_backward): Change heuristic for the case that we didn't move far enough initially. diff -r 8fb314e3c7fd -r c8338f001d95 src/xdisp.c --- a/src/xdisp.c Wed Dec 12 12:35:36 2001 +0000 +++ b/src/xdisp.c Wed Dec 12 13:42:55 2001 +0000 @@ -5373,7 +5373,7 @@ int y0 = it3.current_y; int y1 = line_bottom_y (&it3); int line_height = y1 - y0; - + /* If we did not reach target_y, try to move further backward if we can. If we moved too far backward, try to move forward. */ if (target_y < it->current_y @@ -5384,13 +5384,21 @@ && it->current_y - target_y > line_height / 3 * 2 && IT_CHARPOS (*it) > BEGV) { + TRACE_MOVE ((stderr, " not far enough -> move_vert %d\n", + target_y - it->current_y)); move_it_vertically (it, target_y - it->current_y); xassert (IT_CHARPOS (*it) >= BEGV); } else if (target_y >= it->current_y + line_height && IT_CHARPOS (*it) < ZV) { - move_it_vertically (it, target_y - (it->current_y + line_height)); + /* Should move forward by at least one line, maybe more. */ + do + { + move_it_by_lines (it, 1, 1); + } + while (target_y >= line_bottom_y (it) && IT_CHARPOS (*it) < ZV); + xassert (IT_CHARPOS (*it) >= BEGV); } }