diff options
| author | Eli Zaretskii | 2012-12-03 22:48:12 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2012-12-03 22:48:12 +0200 |
| commit | 3cf3c60796b2dbff6f7300d64210acd1029a17c4 (patch) | |
| tree | d8ce054f70df601ccbfc7569a5b8b3ef1dc95355 /src | |
| parent | 005c8d1340722a2a34b447a2ade4e4bf5bd077d0 (diff) | |
| download | emacs-3cf3c60796b2dbff6f7300d64210acd1029a17c4.tar.gz emacs-3cf3c60796b2dbff6f7300d64210acd1029a17c4.zip | |
Fix bug #13055 with cursor positioning inside scroll-margin.
src/xdisp.c (redisplay_window): If the cursor is visible, but inside
the scroll margin, move point outside the margin.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/xdisp.c | 29 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f2b65db257d..20ed5a99a1a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-12-03 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (redisplay_window): If the cursor is visible, but inside | ||
| 4 | the scroll margin, move point outside the margin. (Bug#13055) | ||
| 5 | |||
| 1 | 2012-12-03 Jan Djärv <jan.h.d@swipnet.se> | 6 | 2012-12-03 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 7 | ||
| 3 | * gtkutil.c (my_log_handler): New function. | 8 | * gtkutil.c (my_log_handler): New function. |
diff --git a/src/xdisp.c b/src/xdisp.c index 6199c2a436e..5f6d69dea3a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -15717,6 +15717,35 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 15717 | Move it back to a fully-visible line. */ | 15717 | Move it back to a fully-visible line. */ |
| 15718 | new_vpos = window_box_height (w); | 15718 | new_vpos = window_box_height (w); |
| 15719 | } | 15719 | } |
| 15720 | else if (w->cursor.vpos >=0) | ||
| 15721 | { | ||
| 15722 | /* Some people insist on not letting point enter the scroll | ||
| 15723 | margin, even though this part handles windows that didn't | ||
| 15724 | scroll at all. */ | ||
| 15725 | struct frame *f = XFRAME (w->frame); | ||
| 15726 | int margin = min (scroll_margin, WINDOW_TOTAL_LINES (w) / 4); | ||
| 15727 | int pixel_margin = margin * FRAME_LINE_HEIGHT (f); | ||
| 15728 | bool header_line = WINDOW_WANTS_HEADER_LINE_P (w); | ||
| 15729 | |||
| 15730 | /* Note: We add an extra FRAME_LINE_HEIGHT, because the loop | ||
| 15731 | below, which finds the row to move point to, advances by | ||
| 15732 | the Y coordinate of the _next_ row, see the definition of | ||
| 15733 | MATRIX_ROW_BOTTOM_Y. */ | ||
| 15734 | if (w->cursor.vpos < margin + header_line) | ||
| 15735 | new_vpos | ||
| 15736 | = pixel_margin + (header_line | ||
| 15737 | ? CURRENT_HEADER_LINE_HEIGHT (w) | ||
| 15738 | : 0) + FRAME_LINE_HEIGHT (f); | ||
| 15739 | else | ||
| 15740 | { | ||
| 15741 | int window_height = window_box_height (w); | ||
| 15742 | |||
| 15743 | if (header_line) | ||
| 15744 | window_height += CURRENT_HEADER_LINE_HEIGHT (w); | ||
| 15745 | if (w->cursor.y >= window_height - pixel_margin) | ||
| 15746 | new_vpos = window_height - pixel_margin; | ||
| 15747 | } | ||
| 15748 | } | ||
| 15720 | 15749 | ||
| 15721 | /* If we need to move point for either of the above reasons, | 15750 | /* If we need to move point for either of the above reasons, |
| 15722 | now actually do it. */ | 15751 | now actually do it. */ |