diff options
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 57 |
1 files changed, 36 insertions, 21 deletions
diff --git a/src/window.c b/src/window.c index 9b8a031f6c1..370251882ba 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -333,11 +333,10 @@ If POS is only out of view because of horizontal scrolling, return non-nil. | |||
| 333 | POS defaults to point in WINDOW; WINDOW defaults to the selected window. | 333 | POS defaults to point in WINDOW; WINDOW defaults to the selected window. |
| 334 | 334 | ||
| 335 | If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, | 335 | If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, |
| 336 | return value is a list (X Y FULLY [RTOP RBOT]) where X and Y are the pixel | 336 | return value is a list (X Y PARTIAL) where X and Y are the pixel coordinates |
| 337 | coordinates relative to the top left corner of the window, and FULLY is t if the | 337 | relative to the top left corner of the window. PARTIAL is nil if the character |
| 338 | character after POS is fully visible and nil otherwise. If FULLY is nil, | 338 | after POS is fully visible; otherwise it is a cons (RTOP . RBOT) where RTOP |
| 339 | RTOP and RBOT are the number of pixels invisible at the top and bottom row | 339 | and RBOT are the number of pixels invisible at the top and bottom of the row. */) |
| 340 | of the window. */) | ||
| 341 | (pos, window, partially) | 340 | (pos, window, partially) |
| 342 | Lisp_Object pos, window, partially; | 341 | Lisp_Object pos, window, partially; |
| 343 | { | 342 | { |
| @@ -376,12 +375,10 @@ of the window. */) | |||
| 376 | if (!NILP (in_window) && !NILP (partially)) | 375 | if (!NILP (in_window) && !NILP (partially)) |
| 377 | in_window = Fcons (make_number (x), | 376 | in_window = Fcons (make_number (x), |
| 378 | Fcons (make_number (y), | 377 | Fcons (make_number (y), |
| 379 | Fcons (fully_p ? Qt : Qnil, | 378 | Fcons ((fully_p ? Qnil |
| 380 | (fully_p | 379 | : Fcons (make_number (rtop), |
| 381 | ? Qnil | 380 | make_number (rbot))), |
| 382 | : Fcons (make_number (rtop), | 381 | Qnil))); |
| 383 | Fcons (make_number (rbot), | ||
| 384 | Qnil)))))); | ||
| 385 | return in_window; | 382 | return in_window; |
| 386 | } | 383 | } |
| 387 | 384 | ||
| @@ -4578,21 +4575,23 @@ window_scroll_pixel_based (window, n, whole, noerror) | |||
| 4578 | } | 4575 | } |
| 4579 | else if (auto_window_vscroll_p) | 4576 | else if (auto_window_vscroll_p) |
| 4580 | { | 4577 | { |
| 4581 | if (NILP (XCAR (XCDR (XCDR (tem))))) | 4578 | if (tem = XCAR (XCDR (XCDR (tem))), CONSP (tem)) |
| 4582 | { | 4579 | { |
| 4583 | int px; | 4580 | int px; |
| 4584 | int dy = WINDOW_FRAME_LINE_HEIGHT (w); | 4581 | int dy = WINDOW_FRAME_LINE_HEIGHT (w); |
| 4585 | if (whole) | 4582 | if (whole) |
| 4586 | 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); | ||
| 4587 | dy *= n; | 4586 | dy *= n; |
| 4588 | 4587 | ||
| 4589 | if (n < 0 && (px = XINT (Fnth (make_number (3), tem))) > 0) | 4588 | if (n < 0 && (px = XINT (XCAR (tem))) > 0) |
| 4590 | { | 4589 | { |
| 4591 | px = max (0, -w->vscroll - min (px, -dy)); | 4590 | px = max (0, -w->vscroll - min (px, -dy)); |
| 4592 | Fset_window_vscroll (window, make_number (px), Qt); | 4591 | Fset_window_vscroll (window, make_number (px), Qt); |
| 4593 | return; | 4592 | return; |
| 4594 | } | 4593 | } |
| 4595 | if (n > 0 && (px = XINT (Fnth (make_number (4), tem))) > 0) | 4594 | if (n > 0 && (px = XINT (XCDR (tem))) > 0) |
| 4596 | { | 4595 | { |
| 4597 | px = max (0, -w->vscroll + min (px, dy)); | 4596 | px = max (0, -w->vscroll + min (px, dy)); |
| 4598 | Fset_window_vscroll (window, make_number (px), Qt); | 4597 | Fset_window_vscroll (window, make_number (px), Qt); |
| @@ -4618,18 +4617,34 @@ window_scroll_pixel_based (window, n, whole, noerror) | |||
| 4618 | start_display (&it, w, start); | 4617 | start_display (&it, w, start); |
| 4619 | if (whole) | 4618 | if (whole) |
| 4620 | { | 4619 | { |
| 4621 | int screen_full = (window_box_height (w) | 4620 | int start_pos = IT_CHARPOS (it); |
| 4622 | - next_screen_context_lines * FRAME_LINE_HEIGHT (it.f)); | 4621 | int dy = WINDOW_FRAME_LINE_HEIGHT (w); |
| 4623 | int dy = n * screen_full; | 4622 | dy = max ((window_box_height (w) |
| 4623 | - next_screen_context_lines * dy), | ||
| 4624 | dy) * n; | ||
| 4624 | 4625 | ||
| 4625 | /* Note that move_it_vertically always moves the iterator to the | 4626 | /* Note that move_it_vertically always moves the iterator to the |
| 4626 | 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, |
| 4627 | 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. */ |
| 4628 | if (dy <= 0) | 4629 | if (dy <= 0) |
| 4629 | 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 | } | ||
| 4630 | else if (dy > 0) | 4638 | else if (dy > 0) |
| 4631 | move_it_to (&it, ZV, -1, it.current_y + dy, -1, | 4639 | { |
| 4632 | MOVE_TO_POS | MOVE_TO_Y); | 4640 | move_it_to (&it, ZV, -1, it.current_y + dy, -1, |
| 4641 | MOVE_TO_POS | MOVE_TO_Y); | ||
| 4642 | /* Ensure we actually does move, e.g. in case we are currently | ||
| 4643 | looking at an image that is taller that the window height. */ | ||
| 4644 | while (start_pos == IT_CHARPOS (it) | ||
| 4645 | && start_pos < ZV) | ||
| 4646 | move_it_by_lines (&it, 1, 1); | ||
| 4647 | } | ||
| 4633 | } | 4648 | } |
| 4634 | else | 4649 | else |
| 4635 | move_it_by_lines (&it, n, 1); | 4650 | move_it_by_lines (&it, n, 1); |