5373 |
int y0 = it3.current_y; |
int y0 = it3.current_y; |
5374 |
int y1 = line_bottom_y (&it3); |
int y1 = line_bottom_y (&it3); |
5375 |
int line_height = y1 - y0; |
int line_height = y1 - y0; |
5376 |
|
|
5377 |
/* If we did not reach target_y, try to move further backward if |
/* If we did not reach target_y, try to move further backward if |
5378 |
we can. If we moved too far backward, try to move forward. */ |
we can. If we moved too far backward, try to move forward. */ |
5379 |
if (target_y < it->current_y |
if (target_y < it->current_y |
5384 |
&& it->current_y - target_y > line_height / 3 * 2 |
&& it->current_y - target_y > line_height / 3 * 2 |
5385 |
&& IT_CHARPOS (*it) > BEGV) |
&& IT_CHARPOS (*it) > BEGV) |
5386 |
{ |
{ |
5387 |
|
TRACE_MOVE ((stderr, " not far enough -> move_vert %d\n", |
5388 |
|
target_y - it->current_y)); |
5389 |
move_it_vertically (it, target_y - it->current_y); |
move_it_vertically (it, target_y - it->current_y); |
5390 |
xassert (IT_CHARPOS (*it) >= BEGV); |
xassert (IT_CHARPOS (*it) >= BEGV); |
5391 |
} |
} |
5392 |
else if (target_y >= it->current_y + line_height |
else if (target_y >= it->current_y + line_height |
5393 |
&& IT_CHARPOS (*it) < ZV) |
&& IT_CHARPOS (*it) < ZV) |
5394 |
{ |
{ |
5395 |
move_it_vertically (it, target_y - (it->current_y + line_height)); |
/* Should move forward by at least one line, maybe more. */ |
5396 |
|
do |
5397 |
|
{ |
5398 |
|
move_it_by_lines (it, 1, 1); |
5399 |
|
} |
5400 |
|
while (target_y >= line_bottom_y (it) && IT_CHARPOS (*it) < ZV); |
5401 |
|
|
5402 |
xassert (IT_CHARPOS (*it) >= BEGV); |
xassert (IT_CHARPOS (*it) >= BEGV); |
5403 |
} |
} |
5404 |
} |
} |