# HG changeset patch # User Kim F. Storm # Date 1100307947 0 # Node ID a17934e924af0c12589748468652d3e0747edc0a # Parent fbb7fdcdbde5d10b23f0a607d3e978f12acd9d90 (make_cursor_line_fully_visible_p): New variable. (syms_of_xdisp): DEFVAR_BOOL it. (make_cursor_line_fully_visible, try_cursor_movement) (try_window_id): Use it. diff -r fbb7fdcdbde5 -r a17934e924af src/xdisp.c --- a/src/xdisp.c Sat Nov 13 00:57:27 2004 +0000 +++ b/src/xdisp.c Sat Nov 13 01:05:47 2004 +0000 @@ -264,6 +264,10 @@ int auto_raise_tool_bar_buttons_p; +/* Non-zero means to reposition window if cursor line is only partially visible. */ + +int make_cursor_line_fully_visible_p; + /* Margin around tool bar buttons in pixels. */ Lisp_Object Vtool_bar_button_margin; @@ -10887,6 +10891,9 @@ struct glyph_row *row; int window_height; + if (!make_cursor_line_fully_visible_p) + return 1; + /* It's not always possible to find the cursor, e.g, when a window is full of overlay strings. Don't do anything in that case. */ if (w->cursor.vpos < 0) @@ -11474,7 +11481,8 @@ /* if PT is not in the glyph row, give up. */ rc = CURSOR_MOVEMENT_MUST_SCROLL; } - else if (MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)) + else if (MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row) + && make_cursor_line_fully_visible_p) { if (PT == MATRIX_ROW_END_CHARPOS (row) && !row->ends_at_zv_p @@ -13515,7 +13523,9 @@ && CHARPOS (start) > BEGV) /* Old redisplay didn't take scroll margin into account at the bottom, but then global-hl-line-mode doesn't scroll. KFS 2004-06-14 */ - || w->cursor.y + cursor_height + this_scroll_margin > it.last_visible_y) + || (w->cursor.y + (make_cursor_line_fully_visible_p + ? cursor_height + this_scroll_margin + : 1)) > it.last_visible_y) { w->cursor.vpos = -1; clear_glyph_matrix (w->desired_matrix); @@ -22391,6 +22401,10 @@ doc: /* *Non-nil means raise tool-bar buttons when the mouse moves over them. */); auto_raise_tool_bar_buttons_p = 1; + DEFVAR_BOOL ("make-cursor-line-fully-visible", &make_cursor_line_fully_visible_p, + doc: /* *Non-nil means to scroll (recenter) cursor line if it is not fully visible. */); + make_cursor_line_fully_visible_p = 1; + DEFVAR_LISP ("tool-bar-button-margin", &Vtool_bar_button_margin, doc: /* *Margin around tool-bar buttons in pixels. If an integer, use that for both horizontal and vertical margins.