diff options
| author | Gerd Moellmann | 2001-12-12 13:42:55 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-12-12 13:42:55 +0000 |
| commit | f7ccfc8c711b842cb3d1e3c9780b5f9c039daedd (patch) | |
| tree | b00027e3d03b0982c97465dc80d84af171e3530d /src | |
| parent | 5f3648c49c5cd573a0c94bc54d35afe29be58849 (diff) | |
| download | emacs-f7ccfc8c711b842cb3d1e3c9780b5f9c039daedd.tar.gz emacs-f7ccfc8c711b842cb3d1e3c9780b5f9c039daedd.zip | |
(move_it_vertically_backward): Change heuristic
for the case that we didn't move far enough initially.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 91558067d1f..4fed4ac4159 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -5373,7 +5373,7 @@ move_it_vertically_backward (it, dy) | |||
| 5373 | int y0 = it3.current_y; | 5373 | int y0 = it3.current_y; |
| 5374 | int y1 = line_bottom_y (&it3); | 5374 | int y1 = line_bottom_y (&it3); |
| 5375 | int line_height = y1 - y0; | 5375 | int line_height = y1 - y0; |
| 5376 | 5376 | ||
| 5377 | /* If we did not reach target_y, try to move further backward if | 5377 | /* 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. */ | 5378 | we can. If we moved too far backward, try to move forward. */ |
| 5379 | if (target_y < it->current_y | 5379 | if (target_y < it->current_y |
| @@ -5384,13 +5384,21 @@ move_it_vertically_backward (it, dy) | |||
| 5384 | && it->current_y - target_y > line_height / 3 * 2 | 5384 | && it->current_y - target_y > line_height / 3 * 2 |
| 5385 | && IT_CHARPOS (*it) > BEGV) | 5385 | && IT_CHARPOS (*it) > BEGV) |
| 5386 | { | 5386 | { |
| 5387 | TRACE_MOVE ((stderr, " not far enough -> move_vert %d\n", | ||
| 5388 | target_y - it->current_y)); | ||
| 5387 | move_it_vertically (it, target_y - it->current_y); | 5389 | move_it_vertically (it, target_y - it->current_y); |
| 5388 | xassert (IT_CHARPOS (*it) >= BEGV); | 5390 | xassert (IT_CHARPOS (*it) >= BEGV); |
| 5389 | } | 5391 | } |
| 5390 | else if (target_y >= it->current_y + line_height | 5392 | else if (target_y >= it->current_y + line_height |
| 5391 | && IT_CHARPOS (*it) < ZV) | 5393 | && IT_CHARPOS (*it) < ZV) |
| 5392 | { | 5394 | { |
| 5393 | move_it_vertically (it, target_y - (it->current_y + line_height)); | 5395 | /* 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 | |||
| 5394 | xassert (IT_CHARPOS (*it) >= BEGV); | 5402 | xassert (IT_CHARPOS (*it) >= BEGV); |
| 5395 | } | 5403 | } |
| 5396 | } | 5404 | } |