diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 614bb898ed8..1912937c1b7 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -264,6 +264,10 @@ int mouse_autoselect_window; | |||
| 264 | 264 | ||
| 265 | int auto_raise_tool_bar_buttons_p; | 265 | int auto_raise_tool_bar_buttons_p; |
| 266 | 266 | ||
| 267 | /* Non-zero means to reposition window if cursor line is only partially visible. */ | ||
| 268 | |||
| 269 | int make_cursor_line_fully_visible_p; | ||
| 270 | |||
| 267 | /* Margin around tool bar buttons in pixels. */ | 271 | /* Margin around tool bar buttons in pixels. */ |
| 268 | 272 | ||
| 269 | Lisp_Object Vtool_bar_button_margin; | 273 | Lisp_Object Vtool_bar_button_margin; |
| @@ -10887,6 +10891,9 @@ make_cursor_line_fully_visible (w, force_p) | |||
| 10887 | struct glyph_row *row; | 10891 | struct glyph_row *row; |
| 10888 | int window_height; | 10892 | int window_height; |
| 10889 | 10893 | ||
| 10894 | if (!make_cursor_line_fully_visible_p) | ||
| 10895 | return 1; | ||
| 10896 | |||
| 10890 | /* It's not always possible to find the cursor, e.g, when a window | 10897 | /* It's not always possible to find the cursor, e.g, when a window |
| 10891 | is full of overlay strings. Don't do anything in that case. */ | 10898 | is full of overlay strings. Don't do anything in that case. */ |
| 10892 | if (w->cursor.vpos < 0) | 10899 | if (w->cursor.vpos < 0) |
| @@ -11474,7 +11481,8 @@ try_cursor_movement (window, startp, scroll_step) | |||
| 11474 | /* if PT is not in the glyph row, give up. */ | 11481 | /* if PT is not in the glyph row, give up. */ |
| 11475 | rc = CURSOR_MOVEMENT_MUST_SCROLL; | 11482 | rc = CURSOR_MOVEMENT_MUST_SCROLL; |
| 11476 | } | 11483 | } |
| 11477 | else if (MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)) | 11484 | else if (MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row) |
| 11485 | && make_cursor_line_fully_visible_p) | ||
| 11478 | { | 11486 | { |
| 11479 | if (PT == MATRIX_ROW_END_CHARPOS (row) | 11487 | if (PT == MATRIX_ROW_END_CHARPOS (row) |
| 11480 | && !row->ends_at_zv_p | 11488 | && !row->ends_at_zv_p |
| @@ -13515,7 +13523,9 @@ try_window_id (w) | |||
| 13515 | && CHARPOS (start) > BEGV) | 13523 | && CHARPOS (start) > BEGV) |
| 13516 | /* Old redisplay didn't take scroll margin into account at the bottom, | 13524 | /* Old redisplay didn't take scroll margin into account at the bottom, |
| 13517 | but then global-hl-line-mode doesn't scroll. KFS 2004-06-14 */ | 13525 | but then global-hl-line-mode doesn't scroll. KFS 2004-06-14 */ |
| 13518 | || w->cursor.y + cursor_height + this_scroll_margin > it.last_visible_y) | 13526 | || (w->cursor.y + (make_cursor_line_fully_visible_p |
| 13527 | ? cursor_height + this_scroll_margin | ||
| 13528 | : 1)) > it.last_visible_y) | ||
| 13519 | { | 13529 | { |
| 13520 | w->cursor.vpos = -1; | 13530 | w->cursor.vpos = -1; |
| 13521 | clear_glyph_matrix (w->desired_matrix); | 13531 | clear_glyph_matrix (w->desired_matrix); |
| @@ -22391,6 +22401,10 @@ otherwise. */); | |||
| 22391 | doc: /* *Non-nil means raise tool-bar buttons when the mouse moves over them. */); | 22401 | doc: /* *Non-nil means raise tool-bar buttons when the mouse moves over them. */); |
| 22392 | auto_raise_tool_bar_buttons_p = 1; | 22402 | auto_raise_tool_bar_buttons_p = 1; |
| 22393 | 22403 | ||
| 22404 | DEFVAR_BOOL ("make-cursor-line-fully-visible", &make_cursor_line_fully_visible_p, | ||
| 22405 | doc: /* *Non-nil means to scroll (recenter) cursor line if it is not fully visible. */); | ||
| 22406 | make_cursor_line_fully_visible_p = 1; | ||
| 22407 | |||
| 22394 | DEFVAR_LISP ("tool-bar-button-margin", &Vtool_bar_button_margin, | 22408 | DEFVAR_LISP ("tool-bar-button-margin", &Vtool_bar_button_margin, |
| 22395 | doc: /* *Margin around tool-bar buttons in pixels. | 22409 | doc: /* *Margin around tool-bar buttons in pixels. |
| 22396 | If an integer, use that for both horizontal and vertical margins. | 22410 | If an integer, use that for both horizontal and vertical margins. |