Commit 1fb97e79 authored by Eli Zaretskii's avatar Eli Zaretskii

Fix bug #19060 with inaccurate pixel-based scrolling.

 src/window.c (window_scroll_pixel_based): Avoid truncation/rounding
 errors in computing the number of pixels to scroll.  Suggested by
 Kelly Dean <kelly@prtime.org>.
parent d4fceca9
2014-11-15 Eli Zaretskii <eliz@gnu.org>
* window.c (window_scroll_pixel_based): Avoid truncation/rounding
errors in computing the number of pixels to scroll. Suggested by
Kelly Dean <kelly@prtime.org>. (Bug#19060)
2014-11-15 Jan Djärv <jan.h.d@swipnet.se> 2014-11-15 Jan Djärv <jan.h.d@swipnet.se>
* nsmenu.m (update_frame_tool_bar): If tool bar changes height, * nsmenu.m (update_frame_tool_bar): If tool bar changes height,
......
...@@ -4955,9 +4955,14 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) ...@@ -4955,9 +4955,14 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror)
{ {
int px; int px;
int dy = frame_line_height; int dy = frame_line_height;
/* In the below we divide the window box height by the
frame's line height to make the result predictable when
the window box is not an integral multiple of the line
height. This is important to ensure we get back to the
same position when scrolling up, then down. */
if (whole) if (whole)
dy = max ((window_box_height (w) dy = max ((window_box_height (w) / dy
- next_screen_context_lines * dy), - next_screen_context_lines) * dy,
dy); dy);
dy *= n; dy *= n;
...@@ -5039,8 +5044,12 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) ...@@ -5039,8 +5044,12 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror)
{ {
ptrdiff_t start_pos = IT_CHARPOS (it); ptrdiff_t start_pos = IT_CHARPOS (it);
int dy = frame_line_height; int dy = frame_line_height;
dy = max ((window_box_height (w) /* In the below we divide the window box height by the frame's
- next_screen_context_lines * dy), line height to make the result predictable when the window
box is not an integral multiple of the line height. This is
important to ensure we get back to the same position when
scrolling up, then down. */
dy = max ((window_box_height (w) / dy - next_screen_context_lines) * dy,
dy) * n; dy) * n;
/* Note that move_it_vertically always moves the iterator to the /* Note that move_it_vertically always moves the iterator to the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment