comparison src/xdisp.c @ 58192:a17934e924af

(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.
author Kim F. Storm <storm@cua.dk>
date Sat, 13 Nov 2004 01:05:47 +0000
parents 6b52bc413dfc
children b8e8e0772ced
comparison
equal deleted inserted replaced
58191:fbb7fdcdbde5 58192:a17934e924af
261 261
262 /* Non-zero means draw tool bar buttons raised when the mouse moves 262 /* Non-zero means draw tool bar buttons raised when the mouse moves
263 over them. */ 263 over them. */
264 264
265 int auto_raise_tool_bar_buttons_p; 265 int auto_raise_tool_bar_buttons_p;
266
267 /* Non-zero means to reposition window if cursor line is only partially visible. */
268
269 int make_cursor_line_fully_visible_p;
266 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;
270 274
10885 { 10889 {
10886 struct glyph_matrix *matrix; 10890 struct glyph_matrix *matrix;
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)
10893 return 1; 10900 return 1;
10894 10901
11472 || PT > MATRIX_ROW_END_CHARPOS (row)) 11479 || PT > MATRIX_ROW_END_CHARPOS (row))
11473 { 11480 {
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
11481 && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)) 11489 && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))
11482 rc = CURSOR_MOVEMENT_MUST_SCROLL; 11490 rc = CURSOR_MOVEMENT_MUST_SCROLL;
13513 13521
13514 if ((w->cursor.y < this_scroll_margin 13522 if ((w->cursor.y < this_scroll_margin
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);
13522 return -1; 13532 return -1;
13523 } 13533 }
22389 22399
22390 DEFVAR_BOOL ("auto-raise-tool-bar-buttons", &auto_raise_tool_bar_buttons_p, 22400 DEFVAR_BOOL ("auto-raise-tool-bar-buttons", &auto_raise_tool_bar_buttons_p,
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.
22397 Otherwise, value should be a pair of integers `(HORZ . VERT)' with 22411 Otherwise, value should be a pair of integers `(HORZ . VERT)' with
22398 HORZ specifying the horizontal margin, and VERT specifying the 22412 HORZ specifying the horizontal margin, and VERT specifying the