comparison src/window.c @ 59677:d762442d2c8f

(auto_window_vscroll_p): New boolean. (syms_of_window): DEFVAR_BOOL it. (Fpos_visible_in_window_p): Extend return value to include RTOP and RBOT values if FULLY is nil. (window_scroll_pixel_based): Adjust vscroll for partially visible rows if auto_window_vscroll_p is set. (Fset_window_vscroll): Do nothing if vscroll is not modified.
author Kim F. Storm <storm@cua.dk>
date Sat, 22 Jan 2005 01:41:47 +0000
parents 132e8f3a36a1
children 75b50deae4e9 6d92d69fae33
comparison
equal deleted inserted replaced
59676:7e0248c89780 59677:d762442d2c8f
121 Lisp_Object Vother_window_scroll_buffer; 121 Lisp_Object Vother_window_scroll_buffer;
122 122
123 /* Non-nil means it's function to call to display temp buffers. */ 123 /* Non-nil means it's function to call to display temp buffers. */
124 124
125 Lisp_Object Vtemp_buffer_show_function; 125 Lisp_Object Vtemp_buffer_show_function;
126
127 /* Non-zero means line and page scrolling on tall lines (with images)
128 does partial scrolling by modifying window-vscroll. */
129
130 int auto_window_vscroll_p;
126 131
127 /* Non-zero means to use mode-line-inactive face in all windows but the 132 /* Non-zero means to use mode-line-inactive face in all windows but the
128 selected-window and the minibuffer-scroll-window when the 133 selected-window and the minibuffer-scroll-window when the
129 minibuffer is active. */ 134 minibuffer is active. */
130 int mode_line_in_non_selected_windows; 135 int mode_line_in_non_selected_windows;
326 optional argument PARTIALLY is non-nil. 331 optional argument PARTIALLY is non-nil.
327 If POS is only out of view because of horizontal scrolling, return non-nil. 332 If POS is only out of view because of horizontal scrolling, return non-nil.
328 POS defaults to point in WINDOW; WINDOW defaults to the selected window. 333 POS defaults to point in WINDOW; WINDOW defaults to the selected window.
329 334
330 If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, 335 If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil,
331 return value is a list (X Y FULLY) where X and Y are the pixel coordinates 336 return value is a list (X Y FULLY [RTOP RBOT]) where X and Y are the pixel
332 relative to the top left corner of the window, and FULLY is t if the 337 coordinates relative to the top left corner of the window, and FULLY is t if the
333 character after POS is fully visible and nil otherwise. */) 338 character after POS is fully visible and nil otherwise. If FULLY is nil,
339 RTOP and RBOT are the number of pixels invisible at the top and bottom row
340 of the window. */)
334 (pos, window, partially) 341 (pos, window, partially)
335 Lisp_Object pos, window, partially; 342 Lisp_Object pos, window, partially;
336 { 343 {
337 register struct window *w; 344 register struct window *w;
338 register int posint; 345 register int posint;
339 register struct buffer *buf; 346 register struct buffer *buf;
340 struct text_pos top; 347 struct text_pos top;
341 Lisp_Object in_window = Qnil; 348 Lisp_Object in_window = Qnil;
342 int fully_p = 1; 349 int rtop, rbot, fully_p = 1;
343 int x, y; 350 int x, y;
344 351
345 w = decode_window (window); 352 w = decode_window (window);
346 buf = XBUFFER (w->buffer); 353 buf = XBUFFER (w->buffer);
347 SET_TEXT_POS_FROM_MARKER (top, w->start); 354 SET_TEXT_POS_FROM_MARKER (top, w->start);
360 or if window start is out of range, position is not visible. */ 367 or if window start is out of range, position is not visible. */
361 if (posint >= CHARPOS (top) 368 if (posint >= CHARPOS (top)
362 && posint <= BUF_ZV (buf) 369 && posint <= BUF_ZV (buf)
363 && CHARPOS (top) >= BUF_BEGV (buf) 370 && CHARPOS (top) >= BUF_BEGV (buf)
364 && CHARPOS (top) <= BUF_ZV (buf) 371 && CHARPOS (top) <= BUF_ZV (buf)
365 && pos_visible_p (w, posint, &fully_p, &x, &y, NILP (partially)) 372 && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, NILP (partially))
366 && (!NILP (partially) || fully_p)) 373 && (fully_p = !rtop && !rbot, (!NILP (partially) || fully_p)))
367 in_window = Qt; 374 in_window = Qt;
368 375
369 if (!NILP (in_window) && !NILP (partially)) 376 if (!NILP (in_window) && !NILP (partially))
370 in_window = Fcons (make_number (x), 377 in_window = Fcons (make_number (x),
371 Fcons (make_number (y), 378 Fcons (make_number (y),
372 Fcons (fully_p ? Qt : Qnil, Qnil))); 379 Fcons (fully_p ? Qt : Qnil,
380 (fully_p
381 ? Qnil
382 : Fcons (make_number (rtop),
383 Fcons (make_number (rbot),
384 Qnil))))));
373 return in_window; 385 return in_window;
374 } 386 }
375 387
376 388
377 static struct window * 389 static struct window *
4562 it.current_y = 0; 4574 it.current_y = 0;
4563 } 4575 }
4564 4576
4565 start = it.current.pos; 4577 start = it.current.pos;
4566 } 4578 }
4579 else if (auto_window_vscroll_p)
4580 {
4581 if (NILP (XCAR (XCDR (XCDR (tem)))))
4582 {
4583 int px;
4584 int dy = WINDOW_FRAME_LINE_HEIGHT (w);
4585 if (whole)
4586 dy = window_box_height (w) - next_screen_context_lines * dy;
4587 dy *= n;
4588
4589 if (n < 0 && (px = XINT (Fnth (make_number (3), tem))) > 0)
4590 {
4591 px = max (0, -w->vscroll - min (px, -dy));
4592 Fset_window_vscroll (window, make_number (px), Qt);
4593 return;
4594 }
4595 if (n > 0 && (px = XINT (Fnth (make_number (4), tem))) > 0)
4596 {
4597 px = max (0, -w->vscroll + min (px, dy));
4598 Fset_window_vscroll (window, make_number (px), Qt);
4599 return;
4600 }
4601 }
4602 Fset_window_vscroll (window, make_number (0), Qt);
4603 }
4567 4604
4568 /* If scroll_preserve_screen_position is non-nil, we try to set 4605 /* If scroll_preserve_screen_position is non-nil, we try to set
4569 point in the same window line as it is now, so get that line. */ 4606 point in the same window line as it is now, so get that line. */
4570 if (!NILP (Vscroll_preserve_screen_position)) 4607 if (!NILP (Vscroll_preserve_screen_position))
4571 { 4608 {
6333 w->vscroll = - (NILP (pixels_p) 6370 w->vscroll = - (NILP (pixels_p)
6334 ? FRAME_LINE_HEIGHT (f) * XFLOATINT (vscroll) 6371 ? FRAME_LINE_HEIGHT (f) * XFLOATINT (vscroll)
6335 : XFLOATINT (vscroll)); 6372 : XFLOATINT (vscroll));
6336 w->vscroll = min (w->vscroll, 0); 6373 w->vscroll = min (w->vscroll, 0);
6337 6374
6338 /* Adjust glyph matrix of the frame if the virtual display 6375 if (w->vscroll != old_dy)
6339 area becomes larger than before. */ 6376 {
6340 if (w->vscroll < 0 && w->vscroll < old_dy) 6377 /* Adjust glyph matrix of the frame if the virtual display
6341 adjust_glyphs (f); 6378 area becomes larger than before. */
6342 6379 if (w->vscroll < 0 && w->vscroll < old_dy)
6343 /* Prevent redisplay shortcuts. */ 6380 adjust_glyphs (f);
6344 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; 6381
6382 /* Prevent redisplay shortcuts. */
6383 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
6384 }
6345 } 6385 }
6346 6386
6347 return Fwindow_vscroll (window, pixels_p); 6387 return Fwindow_vscroll (window, pixels_p);
6348 } 6388 }
6349 6389
6650 Vother_window_scroll_buffer = Qnil; 6690 Vother_window_scroll_buffer = Qnil;
6651 6691
6652 DEFVAR_BOOL ("pop-up-frames", &pop_up_frames, 6692 DEFVAR_BOOL ("pop-up-frames", &pop_up_frames,
6653 doc: /* *Non-nil means `display-buffer' should make a separate frame. */); 6693 doc: /* *Non-nil means `display-buffer' should make a separate frame. */);
6654 pop_up_frames = 0; 6694 pop_up_frames = 0;
6695
6696 DEFVAR_BOOL ("auto-window-vscroll", &auto_window_vscroll_p,
6697 doc: /* *Non-nil means to automatically adjust `window-vscroll' to view tall lines. */);
6698 auto_window_vscroll_p = 1;
6655 6699
6656 DEFVAR_BOOL ("display-buffer-reuse-frames", &display_buffer_reuse_frames, 6700 DEFVAR_BOOL ("display-buffer-reuse-frames", &display_buffer_reuse_frames,
6657 doc: /* *Non-nil means `display-buffer' should reuse frames. 6701 doc: /* *Non-nil means `display-buffer' should reuse frames.
6658 If the buffer in question is already displayed in a frame, raise that frame. */); 6702 If the buffer in question is already displayed in a frame, raise that frame. */);
6659 display_buffer_reuse_frames = 0; 6703 display_buffer_reuse_frames = 0;