diff options
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/window.c b/src/window.c index e4ff2b41806..7c2b3ca29d2 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -4950,9 +4950,14 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) | |||
| 4950 | { | 4950 | { |
| 4951 | int px; | 4951 | int px; |
| 4952 | int dy = frame_line_height; | 4952 | int dy = frame_line_height; |
| 4953 | /* In the below we divide the window box height by the | ||
| 4954 | frame's line height to make the result predictable when | ||
| 4955 | the window box is not an integral multiple of the line | ||
| 4956 | height. This is important to ensure we get back to the | ||
| 4957 | same position when scrolling up, then down. */ | ||
| 4953 | if (whole) | 4958 | if (whole) |
| 4954 | dy = max ((window_box_height (w) | 4959 | dy = max ((window_box_height (w) / dy |
| 4955 | - next_screen_context_lines * dy), | 4960 | - next_screen_context_lines) * dy, |
| 4956 | dy); | 4961 | dy); |
| 4957 | dy *= n; | 4962 | dy *= n; |
| 4958 | 4963 | ||
| @@ -5034,9 +5039,12 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) | |||
| 5034 | { | 5039 | { |
| 5035 | ptrdiff_t start_pos = IT_CHARPOS (it); | 5040 | ptrdiff_t start_pos = IT_CHARPOS (it); |
| 5036 | int dy = frame_line_height; | 5041 | int dy = frame_line_height; |
| 5037 | 5042 | /* In the below we divide the window box height by the frame's | |
| 5038 | dy = max ((window_box_height (w) | 5043 | line height to make the result predictable when the window |
| 5039 | - next_screen_context_lines * dy), | 5044 | box is not an integral multiple of the line height. This is |
| 5045 | important to ensure we get back to the same position when | ||
| 5046 | scrolling up, then down. */ | ||
| 5047 | dy = max ((window_box_height (w) / dy - next_screen_context_lines) * dy, | ||
| 5040 | dy) * n; | 5048 | dy) * n; |
| 5041 | 5049 | ||
| 5042 | /* Note that move_it_vertically always moves the iterator to the | 5050 | /* Note that move_it_vertically always moves the iterator to the |