aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorChong Yidong2006-02-28 14:52:46 +0000
committerChong Yidong2006-02-28 14:52:46 +0000
commitc525d842f8a75a19c870971c176ce7fd50cc21c9 (patch)
tree8dce8420691c4d932c8d9dc6cf602af00d39699e /src/window.c
parent29ecdb2212662dd0c73f9338aea8ea8dd0de2df3 (diff)
downloademacs-c525d842f8a75a19c870971c176ce7fd50cc21c9.tar.gz
emacs-c525d842f8a75a19c870971c176ce7fd50cc21c9.zip
* xselect.c (x_catch_errors_unwind): New function.
(x_reply_selection_request): Put x_uncatch_errors in an unwind. (Fx_get_atom_name): Call x_uncatch_errors earlier. * window.c (Qscroll_up, Qscroll_down): New syms. (window_scroll_pixel_based): Make preserve_y static to avoid getting point stuck when scrolling 1 line.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/window.c b/src/window.c
index 41eaf78bea0..cd7c1e6a625 100644
--- a/src/window.c
+++ b/src/window.c
@@ -50,6 +50,7 @@ Boston, MA 02110-1301, USA. */
50 50
51 51
52Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p; 52Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
53Lisp_Object Qscroll_up, Qscroll_down;
53Lisp_Object Qwindow_size_fixed; 54Lisp_Object Qwindow_size_fixed;
54extern Lisp_Object Qleft_margin, Qright_margin; 55extern Lisp_Object Qleft_margin, Qright_margin;
55 56
@@ -4721,9 +4722,9 @@ window_scroll_pixel_based (window, n, whole, noerror)
4721 struct text_pos start; 4722 struct text_pos start;
4722 Lisp_Object tem; 4723 Lisp_Object tem;
4723 int this_scroll_margin; 4724 int this_scroll_margin;
4724 int preserve_y;
4725 /* True if we fiddled the window vscroll field without really scrolling. */ 4725 /* True if we fiddled the window vscroll field without really scrolling. */
4726 int vscrolled = 0; 4726 int vscrolled = 0;
4727 static int preserve_y = -1;
4727 4728
4728 SET_TEXT_POS_FROM_MARKER (start, w->start); 4729 SET_TEXT_POS_FROM_MARKER (start, w->start);
4729 4730
@@ -4787,9 +4788,18 @@ window_scroll_pixel_based (window, n, whole, noerror)
4787 point in the same window line as it is now, so get that line. */ 4788 point in the same window line as it is now, so get that line. */
4788 if (!NILP (Vscroll_preserve_screen_position)) 4789 if (!NILP (Vscroll_preserve_screen_position))
4789 { 4790 {
4790 start_display (&it, w, start); 4791 /* We preserve the goal pixel coordinate across consecutive
4791 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); 4792 calls to scroll-up or scroll-down. This avoids the
4792 preserve_y = it.current_y; 4793 possibility of point becoming "stuck" on a tall line when
4794 scrolling by one line. */
4795 if (preserve_y < 0
4796 || (current_kboard->Vlast_command != Qscroll_up
4797 && current_kboard->Vlast_command != Qscroll_down))
4798 {
4799 start_display (&it, w, start);
4800 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
4801 preserve_y = it.current_y;
4802 }
4793 } 4803 }
4794 else 4804 else
4795 preserve_y = -1; 4805 preserve_y = -1;
@@ -4926,10 +4936,9 @@ window_scroll_pixel_based (window, n, whole, noerror)
4926 { 4936 {
4927 /* If we have a header line, take account of it. 4937 /* If we have a header line, take account of it.
4928 This is necessary because we set it.current_y to 0, above. */ 4938 This is necessary because we set it.current_y to 0, above. */
4929 if (WINDOW_WANTS_HEADER_LINE_P (w)) 4939 move_it_to (&it, -1, -1,
4930 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w); 4940 preserve_y - (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0 ),
4931 4941 -1, MOVE_TO_Y);
4932 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y);
4933 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); 4942 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
4934 } 4943 }
4935 else 4944 else
@@ -4983,15 +4992,9 @@ window_scroll_pixel_based (window, n, whole, noerror)
4983 { 4992 {
4984 SET_TEXT_POS_FROM_MARKER (start, w->start); 4993 SET_TEXT_POS_FROM_MARKER (start, w->start);
4985 start_display (&it, w, start); 4994 start_display (&it, w, start);
4986#if 0 /* It's wrong to subtract this here 4995 /* It would be wrong to subtract CURRENT_HEADER_LINE_HEIGHT
4987 because we called start_display again 4996 here because we called start_display again and did not
4988 and did not alter it.current_y this time. */ 4997 alter it.current_y this time. */
4989
4990 /* If we have a header line, take account of it. */
4991 if (WINDOW_WANTS_HEADER_LINE_P (w))
4992 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w);
4993#endif
4994
4995 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y); 4998 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y);
4996 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); 4999 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
4997 } 5000 }
@@ -6988,6 +6991,12 @@ init_window ()
6988void 6991void
6989syms_of_window () 6992syms_of_window ()
6990{ 6993{
6994 Qscroll_up = intern ("scroll-up");
6995 staticpro (&Qscroll_up);
6996
6997 Qscroll_down = intern ("scroll-down");
6998 staticpro (&Qscroll_down);
6999
6991 Qwindow_size_fixed = intern ("window-size-fixed"); 7000 Qwindow_size_fixed = intern ("window-size-fixed");
6992 staticpro (&Qwindow_size_fixed); 7001 staticpro (&Qwindow_size_fixed);
6993 Fset (Qwindow_size_fixed, Qnil); 7002 Fset (Qwindow_size_fixed, Qnil);