aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorEli Zaretskii2017-11-23 22:29:59 +0200
committerEli Zaretskii2017-11-23 22:29:59 +0200
commitb081ec9dd7e4575b82872e16e598566fabf77cb1 (patch)
treed2331e5dd8319849eec1a7ff4a3211d53c4cda86 /src/window.c
parent8e40429c960a9dd42103be9c41db5a3af7f9ee25 (diff)
downloademacs-b081ec9dd7e4575b82872e16e598566fabf77cb1.tar.gz
emacs-b081ec9dd7e4575b82872e16e598566fabf77cb1.zip
Fix backward scrolling in buffers with header-line
* src/window.c (window_scroll_pixel_based): Account for the header-line when comparing Y coordinate with the last_visible_y. (Bug#29325)
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/window.c b/src/window.c
index 7f472523b49..504dcd38357 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5355,6 +5355,9 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror)
5355 /* We moved the window start towards BEGV, so PT may be now 5355 /* We moved the window start towards BEGV, so PT may be now
5356 in the scroll margin at the bottom. */ 5356 in the scroll margin at the bottom. */
5357 move_it_to (&it, PT, -1, 5357 move_it_to (&it, PT, -1,
5358 /* We subtract WINDOW_HEADER_LINE_HEIGHT because
5359 it.y is relative to the bottom of the header
5360 line, see above. */
5358 (it.last_visible_y - WINDOW_HEADER_LINE_HEIGHT (w) 5361 (it.last_visible_y - WINDOW_HEADER_LINE_HEIGHT (w)
5359 - partial_line_height (&it) - this_scroll_margin - 1), 5362 - partial_line_height (&it) - this_scroll_margin - 1),
5360 -1, 5363 -1,
@@ -5392,11 +5395,14 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror)
5392 5395
5393 /* See if point is on a partially visible line at the end. */ 5396 /* See if point is on a partially visible line at the end. */
5394 if (it.what == IT_EOB) 5397 if (it.what == IT_EOB)
5395 partial_p = it.current_y + it.ascent + it.descent > it.last_visible_y; 5398 partial_p =
5399 it.current_y + it.ascent + it.descent
5400 > it.last_visible_y - WINDOW_HEADER_LINE_HEIGHT (w);
5396 else 5401 else
5397 { 5402 {
5398 move_it_by_lines (&it, 1); 5403 move_it_by_lines (&it, 1);
5399 partial_p = it.current_y > it.last_visible_y; 5404 partial_p =
5405 it.current_y > it.last_visible_y - WINDOW_HEADER_LINE_HEIGHT (w);
5400 } 5406 }
5401 5407
5402 if (charpos == PT && !partial_p 5408 if (charpos == PT && !partial_p
@@ -5415,7 +5421,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror)
5415 goal_y = this_scroll_margin; 5421 goal_y = this_scroll_margin;
5416 SET_TEXT_POS_FROM_MARKER (start, w->start); 5422 SET_TEXT_POS_FROM_MARKER (start, w->start);
5417 start_display (&it, w, start); 5423 start_display (&it, w, start);
5418 /* It would be wrong to subtract CURRENT_HEADER_LINE_HEIGHT 5424 /* It would be wrong to subtract WINDOW_HEADER_LINE_HEIGHT
5419 here because we called start_display again and did not 5425 here because we called start_display again and did not
5420 alter it.current_y this time. */ 5426 alter it.current_y this time. */
5421 move_it_to (&it, -1, window_scroll_pixel_based_preserve_x, 5427 move_it_to (&it, -1, window_scroll_pixel_based_preserve_x,