Mercurial > emacs
comparison src/window.c @ 63865:a473419e315e
(window_scroll_pixel_based, window_scroll_line_based):
Handle `scroll-preserve-screen-position' non-nil, non-t specially.
(syms_of_window): <scroll-preserve-screen-position>: Doc fix.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 29 Jun 2005 23:29:01 +0000 |
parents | e674f801b65f |
children | 5ce023c9db0d |
comparison
equal
deleted
inserted
replaced
63864:32b373355253 | 63865:a473419e315e |
---|---|
4781 if (n > 0) | 4781 if (n > 0) |
4782 { | 4782 { |
4783 /* We moved the window start towards ZV, so PT may be now | 4783 /* We moved the window start towards ZV, so PT may be now |
4784 in the scroll margin at the top. */ | 4784 in the scroll margin at the top. */ |
4785 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); | 4785 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); |
4786 if (IT_CHARPOS (it) == PT && it.current_y >= this_scroll_margin) | 4786 if (IT_CHARPOS (it) == PT && it.current_y >= this_scroll_margin |
4787 && (NILP (Vscroll_preserve_screen_position) | |
4788 || EQ (Vscroll_preserve_screen_position, Qt))) | |
4787 /* We found PT at a legitimate height. Leave it alone. */ | 4789 /* We found PT at a legitimate height. Leave it alone. */ |
4788 ; | 4790 ; |
4789 else if (preserve_y >= 0) | 4791 else if (preserve_y >= 0) |
4790 { | 4792 { |
4791 /* If we have a header line, take account of it. | 4793 /* If we have a header line, take account of it. |
4834 { | 4836 { |
4835 move_it_by_lines (&it, 1, 1); | 4837 move_it_by_lines (&it, 1, 1); |
4836 partial_p = it.current_y > it.last_visible_y; | 4838 partial_p = it.current_y > it.last_visible_y; |
4837 } | 4839 } |
4838 | 4840 |
4839 if (charpos == PT && !partial_p) | 4841 if (charpos == PT && !partial_p |
4842 && (NILP (Vscroll_preserve_screen_position) | |
4843 || EQ (Vscroll_preserve_screen_position, Qt))) | |
4840 /* We found PT before we found the display margin, so PT is ok. */ | 4844 /* We found PT before we found the display margin, so PT is ok. */ |
4841 ; | 4845 ; |
4842 else if (preserve_y >= 0) | 4846 else if (preserve_y >= 0) |
4843 { | 4847 { |
4844 SET_TEXT_POS_FROM_MARKER (start, w->start); | 4848 SET_TEXT_POS_FROM_MARKER (start, w->start); |
4949 XSETFASTINT (w->last_overlay_modified, 0); | 4953 XSETFASTINT (w->last_overlay_modified, 0); |
4950 /* Set force_start so that redisplay_window will run | 4954 /* Set force_start so that redisplay_window will run |
4951 the window-scroll-functions. */ | 4955 the window-scroll-functions. */ |
4952 w->force_start = Qt; | 4956 w->force_start = Qt; |
4953 | 4957 |
4954 if (whole && !NILP (Vscroll_preserve_screen_position)) | 4958 if (!NILP (Vscroll_preserve_screen_position) |
4959 && (whole || !EQ (Vscroll_preserve_screen_position, Qt))) | |
4955 { | 4960 { |
4956 SET_PT_BOTH (pos, pos_byte); | 4961 SET_PT_BOTH (pos, pos_byte); |
4957 Fvertical_motion (make_number (original_vpos), window); | 4962 Fvertical_motion (make_number (original_vpos), window); |
4958 } | 4963 } |
4959 /* If we scrolled forward, put point enough lines down | 4964 /* If we scrolled forward, put point enough lines down |
6912 doc: /* *Delete any window less than this wide. */); | 6917 doc: /* *Delete any window less than this wide. */); |
6913 window_min_width = 10; | 6918 window_min_width = 10; |
6914 | 6919 |
6915 DEFVAR_LISP ("scroll-preserve-screen-position", | 6920 DEFVAR_LISP ("scroll-preserve-screen-position", |
6916 &Vscroll_preserve_screen_position, | 6921 &Vscroll_preserve_screen_position, |
6917 doc: /* *Non-nil means scroll commands move point to keep its screen line unchanged. | 6922 doc: /* *Controls if scroll commands move point to keep its screen line unchanged. |
6918 This is only when it is impossible to keep point fixed and still | 6923 A value of nil means point does not keep its screen position except |
6919 scroll as specified. */); | 6924 at the scroll margin or window boundary respectively. |
6925 A value of t means point keeps its screen position if the scroll | |
6926 command moved it vertically out of the window, e.g. when scrolling | |
6927 by full screens. | |
6928 Any other value means point always keeps its screen position. */); | |
6920 Vscroll_preserve_screen_position = Qnil; | 6929 Vscroll_preserve_screen_position = Qnil; |
6921 | 6930 |
6922 DEFVAR_LISP ("window-configuration-change-hook", | 6931 DEFVAR_LISP ("window-configuration-change-hook", |
6923 &Vwindow_configuration_change_hook, | 6932 &Vwindow_configuration_change_hook, |
6924 doc: /* Functions to call when window configuration changes. | 6933 doc: /* Functions to call when window configuration changes. |