diff options
| author | Kim F. Storm | 2005-01-24 13:22:29 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2005-01-24 13:22:29 +0000 |
| commit | e856c2162b0b024acf8dd316c5e47b3f938a0fb1 (patch) | |
| tree | 65fd8269fdbaf1759b3e10524be7809293805ede /src | |
| parent | 6f67f013b6238a7c0b9a6904eea8cd912aa62d2e (diff) | |
| download | emacs-e856c2162b0b024acf8dd316c5e47b3f938a0fb1.tar.gz emacs-e856c2162b0b024acf8dd316c5e47b3f938a0fb1.zip | |
(window_scroll_pixel_based): Fix scrolling in the wrong
direction if window height was smaller than next-screen-context-lines.
Now always scroll at least one line in the requested direction.
Ensure that we actually do scroll backwards when requested to do so.
Diffstat (limited to 'src')
| -rw-r--r-- | src/window.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/window.c b/src/window.c index bdc105da3ed..07b197cef75 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -4580,7 +4580,9 @@ window_scroll_pixel_based (window, n, whole, noerror) | |||
| 4580 | int px; | 4580 | int px; |
| 4581 | int dy = WINDOW_FRAME_LINE_HEIGHT (w); | 4581 | int dy = WINDOW_FRAME_LINE_HEIGHT (w); |
| 4582 | if (whole) | 4582 | if (whole) |
| 4583 | dy = window_box_height (w) - next_screen_context_lines * dy; | 4583 | dy = max ((window_box_height (w) |
| 4584 | - next_screen_context_lines * dy), | ||
| 4585 | dy); | ||
| 4584 | dy *= n; | 4586 | dy *= n; |
| 4585 | 4587 | ||
| 4586 | if (n < 0 && (px = XINT (XCAR (tem))) > 0) | 4588 | if (n < 0 && (px = XINT (XCAR (tem))) > 0) |
| @@ -4615,18 +4617,26 @@ window_scroll_pixel_based (window, n, whole, noerror) | |||
| 4615 | start_display (&it, w, start); | 4617 | start_display (&it, w, start); |
| 4616 | if (whole) | 4618 | if (whole) |
| 4617 | { | 4619 | { |
| 4618 | int screen_full = (window_box_height (w) | 4620 | int start_pos = IT_CHARPOS (it); |
| 4619 | - next_screen_context_lines * FRAME_LINE_HEIGHT (it.f)); | 4621 | int dy = WINDOW_FRAME_LINE_HEIGHT (w); |
| 4620 | int dy = n * screen_full; | 4622 | dy = max ((window_box_height (w) |
| 4623 | - next_screen_context_lines * dy), | ||
| 4624 | dy) * n; | ||
| 4621 | 4625 | ||
| 4622 | /* Note that move_it_vertically always moves the iterator to the | 4626 | /* Note that move_it_vertically always moves the iterator to the |
| 4623 | start of a line. So, if the last line doesn't have a newline, | 4627 | start of a line. So, if the last line doesn't have a newline, |
| 4624 | we would end up at the start of the line ending at ZV. */ | 4628 | we would end up at the start of the line ending at ZV. */ |
| 4625 | if (dy <= 0) | 4629 | if (dy <= 0) |
| 4626 | move_it_vertically_backward (&it, -dy); | 4630 | { |
| 4631 | move_it_vertically_backward (&it, -dy); | ||
| 4632 | /* Ensure we actually does move, e.g. in case we are currently | ||
| 4633 | looking at an image that is taller that the window height. */ | ||
| 4634 | while (start_pos == IT_CHARPOS (it) | ||
| 4635 | && start_pos > BEGV) | ||
| 4636 | move_it_by_lines (&it, -1, 1); | ||
| 4637 | } | ||
| 4627 | else if (dy > 0) | 4638 | else if (dy > 0) |
| 4628 | { | 4639 | { |
| 4629 | int start_pos = IT_CHARPOS (it); | ||
| 4630 | move_it_to (&it, ZV, -1, it.current_y + dy, -1, | 4640 | move_it_to (&it, ZV, -1, it.current_y + dy, -1, |
| 4631 | MOVE_TO_POS | MOVE_TO_Y); | 4641 | MOVE_TO_POS | MOVE_TO_Y); |
| 4632 | /* Ensure we actually does move, e.g. in case we are currently | 4642 | /* Ensure we actually does move, e.g. in case we are currently |