diff options
| author | Kim F. Storm | 2005-01-22 01:41:47 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2005-01-22 01:41:47 +0000 |
| commit | e56263e5264fb804da004bf51d649e6b7240c5f3 (patch) | |
| tree | fdc49a2c84a16441d80c230e704201e8846e2c17 /src/window.c | |
| parent | f15f5495d9403a19900402965ad3d34f78562ffa (diff) | |
| download | emacs-e56263e5264fb804da004bf51d649e6b7240c5f3.tar.gz emacs-e56263e5264fb804da004bf51d649e6b7240c5f3.zip | |
(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.
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 70 |
1 files changed, 57 insertions, 13 deletions
diff --git a/src/window.c b/src/window.c index 735bd99fd55..85376dd7b50 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -124,6 +124,11 @@ Lisp_Object Vother_window_scroll_buffer; | |||
| 124 | 124 | ||
| 125 | Lisp_Object Vtemp_buffer_show_function; | 125 | Lisp_Object Vtemp_buffer_show_function; |
| 126 | 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; | ||
| 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. */ |
| @@ -328,9 +333,11 @@ 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 | { |
| @@ -339,7 +346,7 @@ character after POS is fully visible and nil otherwise. */) | |||
| 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); |
| @@ -362,14 +369,19 @@ character after POS is fully visible and nil otherwise. */) | |||
| 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 | ||
| @@ -4564,6 +4576,31 @@ window_scroll_pixel_based (window, n, whole, noerror) | |||
| 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. */ |
| @@ -6335,13 +6372,16 @@ If PIXELS-P is non-nil, the return value is 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. */ |
| 6379 | if (w->vscroll < 0 && w->vscroll < old_dy) | ||
| 6380 | adjust_glyphs (f); | ||
| 6342 | 6381 | ||
| 6343 | /* Prevent redisplay shortcuts. */ | 6382 | /* Prevent redisplay shortcuts. */ |
| 6344 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | 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); |
| @@ -6653,6 +6693,10 @@ is displayed in the `mode-line' face. */); | |||
| 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; |
| 6655 | 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; | ||
| 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. */); |