aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorKaroly Lorentey2005-01-06 15:05:01 +0000
committerKaroly Lorentey2005-01-06 15:05:01 +0000
commitfd41924555942f6c3c1e12400ab313717a3818cd (patch)
tree8d9e405d68e8f6f1d420b35094f150af44518971 /src/window.c
parent0feecea9fb7079a2c1fbfee32a992449a22cf478 (diff)
parent553fd77e2511cdc4d1b45933f237c724ee72c3b9 (diff)
downloademacs-fd41924555942f6c3c1e12400ab313717a3818cd.tar.gz
emacs-fd41924555942f6c3c1e12400ab313717a3818cd.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-753 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-754 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-755 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-756 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-757 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-81 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-82 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-279
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c86
1 files changed, 56 insertions, 30 deletions
diff --git a/src/window.c b/src/window.c
index e3beb4b10a5..ff536be55aa 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4673,30 +4673,32 @@ window_scroll_pixel_based (window, n, whole, noerror)
4673 not including the height of the header line if any. */ 4673 not including the height of the header line if any. */
4674 it.current_y = it.vpos = 0; 4674 it.current_y = it.vpos = 0;
4675 4675
4676 /* Preserve the screen position if we should. */ 4676 /* Move PT out of scroll margins.
4677 if (preserve_y >= 0) 4677 This code wants current_y to be zero at the window start position
4678 even if there is a header line. */
4679 this_scroll_margin = max (0, scroll_margin);
4680 this_scroll_margin = min (this_scroll_margin, XFASTINT (w->total_lines) / 4);
4681 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
4682
4683 if (n > 0)
4678 { 4684 {
4679 /* If we have a header line, take account of it. */ 4685 /* We moved the window start towards ZV, so PT may be now
4680 if (WINDOW_WANTS_HEADER_LINE_P (w)) 4686 in the scroll margin at the top. */
4681 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w); 4687 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
4688 if (IT_CHARPOS (it) == PT && it.current_y >= this_scroll_margin)
4689 /* We found PT at a legitimate height. Leave it alone. */
4690 ;
4691 else if (preserve_y >= 0)
4692 {
4693 /* If we have a header line, take account of it. */
4694 if (WINDOW_WANTS_HEADER_LINE_P (w))
4695 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w);
4682 4696
4683 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y); 4697 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y);
4684 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); 4698 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
4685 } 4699 }
4686 else 4700 else
4687 {
4688 /* Move PT out of scroll margins.
4689 This code wants current_y to be zero at the window start position
4690 even if there is a header line. */
4691 this_scroll_margin = max (0, scroll_margin);
4692 this_scroll_margin = min (this_scroll_margin, XFASTINT (w->total_lines) / 4);
4693 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
4694
4695 if (n > 0)
4696 { 4701 {
4697 /* We moved the window start towards ZV, so PT may be now
4698 in the scroll margin at the top. */
4699 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
4700 while (it.current_y < this_scroll_margin) 4702 while (it.current_y < this_scroll_margin)
4701 { 4703 {
4702 int prev = it.current_y; 4704 int prev = it.current_y;
@@ -4706,22 +4708,44 @@ window_scroll_pixel_based (window, n, whole, noerror)
4706 } 4708 }
4707 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); 4709 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
4708 } 4710 }
4709 else if (n < 0) 4711 }
4710 { 4712 else if (n < 0)
4711 int charpos, bytepos; 4713 {
4714 int charpos, bytepos;
4715
4716 /* Save our position, for the preserve_y case. */
4717 charpos = IT_CHARPOS (it);
4718 bytepos = IT_BYTEPOS (it);
4712 4719
4713 /* We moved the window start towards BEGV, so PT may be now 4720 /* We moved the window start towards BEGV, so PT may be now
4714 in the scroll margin at the bottom. */ 4721 in the scroll margin at the bottom. */
4715 move_it_to (&it, PT, -1, 4722 move_it_to (&it, PT, -1,
4716 it.last_visible_y - this_scroll_margin - 1, -1, 4723 it.last_visible_y - this_scroll_margin - 1, -1,
4717 MOVE_TO_POS | MOVE_TO_Y); 4724 MOVE_TO_POS | MOVE_TO_Y);
4725
4726 if (IT_CHARPOS (it) == PT)
4727 /* We found PT before we found the display margin, so PT is ok. */
4728 ;
4729 else if (preserve_y >= 0)
4730 {
4731 SET_TEXT_POS_FROM_MARKER (start, w->start);
4732 start_display (&it, w, start);
4733 /* If we have a header line, take account of it. */
4734 if (WINDOW_WANTS_HEADER_LINE_P (w))
4735 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w);
4718 4736
4737 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y);
4738 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
4739 }
4740 else
4741 {
4719 /* Save our position, in case it's correct. */ 4742 /* Save our position, in case it's correct. */
4720 charpos = IT_CHARPOS (it); 4743 charpos = IT_CHARPOS (it);
4721 bytepos = IT_BYTEPOS (it); 4744 bytepos = IT_BYTEPOS (it);
4722 4745
4723 /* See if point is on a partially visible line at the end. */ 4746 /* See if point is on a partially visible line at the end. */
4724 move_it_by_lines (&it, 1, 1); 4747 move_it_by_lines (&it, 1, 1);
4748
4725 if (it.current_y > it.last_visible_y) 4749 if (it.current_y > it.last_visible_y)
4726 /* The last line was only partially visible, so back up two 4750 /* The last line was only partially visible, so back up two
4727 lines to make sure we're on a fully visible line. */ 4751 lines to make sure we're on a fully visible line. */
@@ -6755,7 +6779,9 @@ If there is only one window, it is split regardless of this value. */);
6755 6779
6756 DEFVAR_LISP ("scroll-preserve-screen-position", 6780 DEFVAR_LISP ("scroll-preserve-screen-position",
6757 &Vscroll_preserve_screen_position, 6781 &Vscroll_preserve_screen_position,
6758 doc: /* *Non-nil means scroll commands move point to keep its screen line unchanged. */); 6782 doc: /* *Non-nil means scroll commands move point to keep its screen line unchanged.
6783This is only when it is impossible to keep point fixed and still
6784scroll as specified. */);
6759 Vscroll_preserve_screen_position = Qnil; 6785 Vscroll_preserve_screen_position = Qnil;
6760 6786
6761 DEFVAR_LISP ("window-configuration-change-hook", 6787 DEFVAR_LISP ("window-configuration-change-hook",