aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/src/window.c b/src/window.c
index 8e75e460b2b..bcc989b5a79 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5686,27 +5686,20 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror)
5686 we would end up at the start of the line ending at ZV. */ 5686 we would end up at the start of the line ending at ZV. */
5687 if (dy <= 0) 5687 if (dy <= 0)
5688 { 5688 {
5689 goal_y = it.current_y - dy; 5689 goal_y = it.current_y + dy;
5690 move_it_vertically_backward (&it, -dy); 5690 move_it_vertically_backward (&it, -dy);
5691 /* Extra precision for people who want us to preserve the 5691 /* move_it_vertically_backward above always overshoots if DY
5692 screen position of the cursor: effectively round DY to the 5692 cannot be reached exactly, i.e. if it falls in the middle
5693 nearest screen line, instead of rounding to zero; the latter 5693 of a screen line. But if that screen line is large
5694 causes point to move by one line after C-v followed by M-v, 5694 (e.g., a tall image), it might make more sense to
5695 if the buffer has lines of different height. */ 5695 undershoot instead. */
5696 if (!NILP (Vscroll_preserve_screen_position) 5696 if (goal_y - it.current_y > 0.5 * flh)
5697 && it.current_y - goal_y > 0.5 * flh)
5698 { 5697 {
5699 it_data = bidi_shelve_cache (); 5698 it_data = bidi_shelve_cache ();
5700 struct it it2 = it; 5699 struct it it1 = it;
5701 5700 if (line_bottom_y (&it1) - goal_y < goal_y - it.current_y)
5702 move_it_by_lines (&it, -1); 5701 move_it_by_lines (&it, 1);
5703 if (it.current_y < goal_y - 0.5 * flh) 5702 bidi_unshelve_cache (it_data, true);
5704 {
5705 it = it2;
5706 bidi_unshelve_cache (it_data, false);
5707 }
5708 else
5709 bidi_unshelve_cache (it_data, true);
5710 } 5703 }
5711 /* Ensure we actually do move, e.g. in case we are currently 5704 /* Ensure we actually do move, e.g. in case we are currently
5712 looking at an image that is taller that the window height. */ 5705 looking at an image that is taller that the window height. */
@@ -5718,8 +5711,11 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror)
5718 { 5711 {
5719 goal_y = it.current_y + dy; 5712 goal_y = it.current_y + dy;
5720 move_it_to (&it, ZV, -1, goal_y, -1, MOVE_TO_POS | MOVE_TO_Y); 5713 move_it_to (&it, ZV, -1, goal_y, -1, MOVE_TO_POS | MOVE_TO_Y);
5721 /* See the comment above, for the reasons of this 5714 /* Extra precision for people who want us to preserve the
5722 extra-precision. */ 5715 screen position of the cursor: effectively round DY to the
5716 nearest screen line, instead of rounding to zero; the latter
5717 causes point to move by one line after C-v followed by M-v,
5718 if the buffer has lines of different height. */
5723 if (!NILP (Vscroll_preserve_screen_position) 5719 if (!NILP (Vscroll_preserve_screen_position)
5724 && goal_y - it.current_y > 0.5 * flh) 5720 && goal_y - it.current_y > 0.5 * flh)
5725 { 5721 {
@@ -7826,7 +7822,7 @@ set_window_scroll_bars (struct window *w, Lisp_Object width,
7826 if more than a single window needs to be considered, see 7822 if more than a single window needs to be considered, see
7827 redisplay_internal. */ 7823 redisplay_internal. */
7828 if (changed) 7824 if (changed)
7829 windows_or_buffers_changed = 31; 7825 wset_redisplay (w);
7830 7826
7831 return changed ? w : NULL; 7827 return changed ? w : NULL;
7832 } 7828 }