aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorKaroly Lorentey2005-02-03 23:28:36 +0000
committerKaroly Lorentey2005-02-03 23:28:36 +0000
commit597cfb3fbc57114062f12dfdfa37c0157fff1e97 (patch)
treedea42300f641805b707eb9a64035acac8c9f547e /src/window.c
parentfd41924555942f6c3c1e12400ab313717a3818cd (diff)
parent4e07258f2b539fa9a3ba97442e81e3e67a9ce5a7 (diff)
downloademacs-597cfb3fbc57114062f12dfdfa37c0157fff1e97.tar.gz
emacs-597cfb3fbc57114062f12dfdfa37c0157fff1e97.zip
Merged in changes from CVS trunk. (Long time no see!) :-)
Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-83 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-84 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-1 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-2 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-3 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-4 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-5 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-6 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-7 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-8 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-9 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-10 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-11 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-12 Remove "-face" suffix from lazy-highlight face name * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-13 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-14 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-15 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-16 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-17 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-18 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-19 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-20 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-21 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-22 <no summary provided> * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-23 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-24 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-25 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-26 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-27 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-28 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-29 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-30 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-31 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-32 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-33 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-34 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-35 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-36 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-37 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-38 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-39 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-40 Fix regressions from latest reftex update * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-41 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-42 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-43 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-44 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-45 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-46 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-47 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-48 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-49 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-50 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-51 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-52 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-53 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-54 Update from CVS: lisp/cus-start.el (all): Add `undo-outer-limit'. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-55 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-56 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-57 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-58 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-59 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-60 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-61 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-62 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-63 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-64 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-65 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-66 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-67 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-68 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-69 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-70 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-71 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-72 src/dispextern.h (xassert): Enable unconditionally. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-73 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-74 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-75 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--base-0 tag of miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-82 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-1 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-2 Merge from miles@gnu.org--gnu-2004 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-3 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-4 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-5 Update from CVS: exi/gnus-faq.texi ([4.1]): Typo. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-6 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-7 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-8 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-9 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-10 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-11 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-281
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c105
1 files changed, 85 insertions, 20 deletions
diff --git a/src/window.c b/src/window.c
index ff536be55aa..f49e6cccbb7 100644
--- a/src/window.c
+++ b/src/window.c
@@ -126,6 +126,11 @@ Lisp_Object Vother_window_scroll_buffer;
126 126
127Lisp_Object Vtemp_buffer_show_function; 127Lisp_Object Vtemp_buffer_show_function;
128 128
129/* Non-zero means line and page scrolling on tall lines (with images)
130 does partial scrolling by modifying window-vscroll. */
131
132int auto_window_vscroll_p;
133
129/* Non-zero means to use mode-line-inactive face in all windows but the 134/* Non-zero means to use mode-line-inactive face in all windows but the
130 selected-window and the minibuffer-scroll-window when the 135 selected-window and the minibuffer-scroll-window when the
131 minibuffer is active. */ 136 minibuffer is active. */
@@ -330,9 +335,10 @@ If POS is only out of view because of horizontal scrolling, return non-nil.
330POS defaults to point in WINDOW; WINDOW defaults to the selected window. 335POS defaults to point in WINDOW; WINDOW defaults to the selected window.
331 336
332If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, 337If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil,
333return value is a list (X Y FULLY) where X and Y are the pixel coordinates 338return value is a list (X Y PARTIAL) where X and Y are the pixel coordinates
334relative to the top left corner of the window, and FULLY is t if the 339relative to the top left corner of the window. PARTIAL is nil if the character
335character after POS is fully visible and nil otherwise. */) 340after POS is fully visible; otherwise it is a cons (RTOP . RBOT) where RTOP
341and RBOT are the number of pixels invisible at the top and bottom of the row. */)
336 (pos, window, partially) 342 (pos, window, partially)
337 Lisp_Object pos, window, partially; 343 Lisp_Object pos, window, partially;
338{ 344{
@@ -341,7 +347,7 @@ character after POS is fully visible and nil otherwise. */)
341 register struct buffer *buf; 347 register struct buffer *buf;
342 struct text_pos top; 348 struct text_pos top;
343 Lisp_Object in_window = Qnil; 349 Lisp_Object in_window = Qnil;
344 int fully_p = 1; 350 int rtop, rbot, fully_p = 1;
345 int x, y; 351 int x, y;
346 352
347 w = decode_window (window); 353 w = decode_window (window);
@@ -364,14 +370,17 @@ character after POS is fully visible and nil otherwise. */)
364 && posint <= BUF_ZV (buf) 370 && posint <= BUF_ZV (buf)
365 && CHARPOS (top) >= BUF_BEGV (buf) 371 && CHARPOS (top) >= BUF_BEGV (buf)
366 && CHARPOS (top) <= BUF_ZV (buf) 372 && CHARPOS (top) <= BUF_ZV (buf)
367 && pos_visible_p (w, posint, &fully_p, &x, &y, NILP (partially)) 373 && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, NILP (partially))
368 && (!NILP (partially) || fully_p)) 374 && (fully_p = !rtop && !rbot, (!NILP (partially) || fully_p)))
369 in_window = Qt; 375 in_window = Qt;
370 376
371 if (!NILP (in_window) && !NILP (partially)) 377 if (!NILP (in_window) && !NILP (partially))
372 in_window = Fcons (make_number (x), 378 in_window = Fcons (make_number (x),
373 Fcons (make_number (y), 379 Fcons (make_number (y),
374 Fcons (fully_p ? Qt : Qnil, Qnil))); 380 Fcons ((fully_p ? Qnil
381 : Fcons (make_number (rtop),
382 make_number (rbot))),
383 Qnil)));
375 return in_window; 384 return in_window;
376} 385}
377 386
@@ -4566,6 +4575,33 @@ window_scroll_pixel_based (window, n, whole, noerror)
4566 4575
4567 start = it.current.pos; 4576 start = it.current.pos;
4568 } 4577 }
4578 else if (auto_window_vscroll_p)
4579 {
4580 if (tem = XCAR (XCDR (XCDR (tem))), CONSP (tem))
4581 {
4582 int px;
4583 int dy = WINDOW_FRAME_LINE_HEIGHT (w);
4584 if (whole)
4585 dy = max ((window_box_height (w)
4586 - next_screen_context_lines * dy),
4587 dy);
4588 dy *= n;
4589
4590 if (n < 0 && (px = XINT (XCAR (tem))) > 0)
4591 {
4592 px = max (0, -w->vscroll - min (px, -dy));
4593 Fset_window_vscroll (window, make_number (px), Qt);
4594 return;
4595 }
4596 if (n > 0 && (px = XINT (XCDR (tem))) > 0)
4597 {
4598 px = max (0, -w->vscroll + min (px, dy));
4599 Fset_window_vscroll (window, make_number (px), Qt);
4600 return;
4601 }
4602 }
4603 Fset_window_vscroll (window, make_number (0), Qt);
4604 }
4569 4605
4570 /* If scroll_preserve_screen_position is non-nil, we try to set 4606 /* If scroll_preserve_screen_position is non-nil, we try to set
4571 point in the same window line as it is now, so get that line. */ 4607 point in the same window line as it is now, so get that line. */
@@ -4583,18 +4619,34 @@ window_scroll_pixel_based (window, n, whole, noerror)
4583 start_display (&it, w, start); 4619 start_display (&it, w, start);
4584 if (whole) 4620 if (whole)
4585 { 4621 {
4586 int screen_full = (window_box_height (w) 4622 int start_pos = IT_CHARPOS (it);
4587 - next_screen_context_lines * FRAME_LINE_HEIGHT (it.f)); 4623 int dy = WINDOW_FRAME_LINE_HEIGHT (w);
4588 int dy = n * screen_full; 4624 dy = max ((window_box_height (w)
4625 - next_screen_context_lines * dy),
4626 dy) * n;
4589 4627
4590 /* Note that move_it_vertically always moves the iterator to the 4628 /* Note that move_it_vertically always moves the iterator to the
4591 start of a line. So, if the last line doesn't have a newline, 4629 start of a line. So, if the last line doesn't have a newline,
4592 we would end up at the start of the line ending at ZV. */ 4630 we would end up at the start of the line ending at ZV. */
4593 if (dy <= 0) 4631 if (dy <= 0)
4594 move_it_vertically_backward (&it, -dy); 4632 {
4633 move_it_vertically_backward (&it, -dy);
4634 /* Ensure we actually does move, e.g. in case we are currently
4635 looking at an image that is taller that the window height. */
4636 while (start_pos == IT_CHARPOS (it)
4637 && start_pos > BEGV)
4638 move_it_by_lines (&it, -1, 1);
4639 }
4595 else if (dy > 0) 4640 else if (dy > 0)
4596 move_it_to (&it, ZV, -1, it.current_y + dy, -1, 4641 {
4597 MOVE_TO_POS | MOVE_TO_Y); 4642 move_it_to (&it, ZV, -1, it.current_y + dy, -1,
4643 MOVE_TO_POS | MOVE_TO_Y);
4644 /* Ensure we actually does move, e.g. in case we are currently
4645 looking at an image that is taller that the window height. */
4646 while (start_pos == IT_CHARPOS (it)
4647 && start_pos < ZV)
4648 move_it_by_lines (&it, 1, 1);
4649 }
4598 } 4650 }
4599 else 4651 else
4600 move_it_by_lines (&it, n, 1); 4652 move_it_by_lines (&it, n, 1);
@@ -4690,7 +4742,8 @@ window_scroll_pixel_based (window, n, whole, noerror)
4690 ; 4742 ;
4691 else if (preserve_y >= 0) 4743 else if (preserve_y >= 0)
4692 { 4744 {
4693 /* If we have a header line, take account of it. */ 4745 /* If we have a header line, take account of it.
4746 This is necessary because we set it.current_y to 0, above. */
4694 if (WINDOW_WANTS_HEADER_LINE_P (w)) 4747 if (WINDOW_WANTS_HEADER_LINE_P (w))
4695 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w); 4748 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w);
4696 4749
@@ -4730,9 +4783,14 @@ window_scroll_pixel_based (window, n, whole, noerror)
4730 { 4783 {
4731 SET_TEXT_POS_FROM_MARKER (start, w->start); 4784 SET_TEXT_POS_FROM_MARKER (start, w->start);
4732 start_display (&it, w, start); 4785 start_display (&it, w, start);
4786#if 0 /* It's wrong to subtract this here
4787 because we called start_display again
4788 and did not alter it.current_y this time. */
4789
4733 /* If we have a header line, take account of it. */ 4790 /* If we have a header line, take account of it. */
4734 if (WINDOW_WANTS_HEADER_LINE_P (w)) 4791 if (WINDOW_WANTS_HEADER_LINE_P (w))
4735 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w); 4792 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w);
4793#endif
4736 4794
4737 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y); 4795 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y);
4738 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); 4796 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
@@ -6331,13 +6389,16 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */)
6331 : XFLOATINT (vscroll)); 6389 : XFLOATINT (vscroll));
6332 w->vscroll = min (w->vscroll, 0); 6390 w->vscroll = min (w->vscroll, 0);
6333 6391
6334 /* Adjust glyph matrix of the frame if the virtual display 6392 if (w->vscroll != old_dy)
6335 area becomes larger than before. */ 6393 {
6336 if (w->vscroll < 0 && w->vscroll < old_dy) 6394 /* Adjust glyph matrix of the frame if the virtual display
6337 adjust_glyphs (f); 6395 area becomes larger than before. */
6396 if (w->vscroll < 0 && w->vscroll < old_dy)
6397 adjust_glyphs (f);
6338 6398
6339 /* Prevent redisplay shortcuts. */ 6399 /* Prevent redisplay shortcuts. */
6340 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; 6400 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
6401 }
6341 } 6402 }
6342 6403
6343 return Fwindow_vscroll (window, pixels_p); 6404 return Fwindow_vscroll (window, pixels_p);
@@ -6649,6 +6710,10 @@ is displayed in the `mode-line' face. */);
6649 doc: /* *Non-nil means `display-buffer' should make a separate frame. */); 6710 doc: /* *Non-nil means `display-buffer' should make a separate frame. */);
6650 pop_up_frames = 0; 6711 pop_up_frames = 0;
6651 6712
6713 DEFVAR_BOOL ("auto-window-vscroll", &auto_window_vscroll_p,
6714 doc: /* *Non-nil means to automatically adjust `window-vscroll' to view tall lines. */);
6715 auto_window_vscroll_p = 1;
6716
6652 DEFVAR_BOOL ("display-buffer-reuse-frames", &display_buffer_reuse_frames, 6717 DEFVAR_BOOL ("display-buffer-reuse-frames", &display_buffer_reuse_frames,
6653 doc: /* *Non-nil means `display-buffer' should reuse frames. 6718 doc: /* *Non-nil means `display-buffer' should reuse frames.
6654If the buffer in question is already displayed in a frame, raise that frame. */); 6719If the buffer in question is already displayed in a frame, raise that frame. */);