comparison src/window.c @ 59717:351ffb20ab9f

(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.
author Kim F. Storm <storm@cua.dk>
date Mon, 24 Jan 2005 13:22:29 +0000
parents c401b93db575
children d75e10df3675 3dcba0bc766b befae6bafecb
comparison
equal deleted inserted replaced
59716:00046b439a5e 59717:351ffb20ab9f
4578 if (tem = XCAR (XCDR (XCDR (tem))), CONSP (tem)) 4578 if (tem = XCAR (XCDR (XCDR (tem))), CONSP (tem))
4579 { 4579 {
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)
4587 { 4589 {
4588 px = max (0, -w->vscroll - min (px, -dy)); 4590 px = max (0, -w->vscroll - min (px, -dy));
4613 /* Move iterator it from start the specified distance forward or 4615 /* Move iterator it from start the specified distance forward or
4614 backward. The result is the new window start. */ 4616 backward. The result is the new window start. */
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
4633 looking at an image that is taller that the window height. */ 4643 looking at an image that is taller that the window height. */
4634 while (start_pos == IT_CHARPOS (it) 4644 while (start_pos == IT_CHARPOS (it)