comparison src/window.c @ 108453:6ebf8ca9708b

Merge from mainline.
author Katsumi Yamaoka <katsumi@flagship2>
date Thu, 22 Apr 2010 12:19:18 +0000
parents d7b161b7a686
children 4a42850741ad
comparison
equal deleted inserted replaced
108452:b586617999c7 108453:6ebf8ca9708b
52 #endif 52 #endif
53 53
54 54
55 Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p; 55 Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
56 Lisp_Object Qdisplay_buffer; 56 Lisp_Object Qdisplay_buffer;
57 Lisp_Object Qscroll_up, Qscroll_down; 57 Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command;
58 Lisp_Object Qwindow_size_fixed; 58 Lisp_Object Qwindow_size_fixed;
59 59
60 extern Lisp_Object Qleft_margin, Qright_margin; 60 extern Lisp_Object Qleft_margin, Qright_margin;
61 61
62 static int displayed_window_lines P_ ((struct window *)); 62 static int displayed_window_lines P_ ((struct window *));
165 165
166 /* Non-nil means scroll commands try to put point 166 /* Non-nil means scroll commands try to put point
167 at the same screen height as previously. */ 167 at the same screen height as previously. */
168 168
169 Lisp_Object Vscroll_preserve_screen_position; 169 Lisp_Object Vscroll_preserve_screen_position;
170
171 /* List of commands affected by `Vscroll_preserve_screen_position'. */
172
173 Lisp_Object Vscroll_preserve_screen_position_commands;
174 170
175 /* Non-nil means that text is inserted before window's markers. */ 171 /* Non-nil means that text is inserted before window's markers. */
176 172
177 Lisp_Object Vwindow_point_insertion_type; 173 Lisp_Object Vwindow_point_insertion_type;
178 174
4944 /* If scroll_preserve_screen_position is non-nil, we try to set 4940 /* If scroll_preserve_screen_position is non-nil, we try to set
4945 point in the same window line as it is now, so get that line. */ 4941 point in the same window line as it is now, so get that line. */
4946 if (!NILP (Vscroll_preserve_screen_position)) 4942 if (!NILP (Vscroll_preserve_screen_position))
4947 { 4943 {
4948 /* We preserve the goal pixel coordinate across consecutive 4944 /* We preserve the goal pixel coordinate across consecutive
4949 calls to scroll-up or scroll-down. This avoids the 4945 calls to scroll-up, scroll-down and other commands that
4946 have the `scroll-command' property. This avoids the
4950 possibility of point becoming "stuck" on a tall line when 4947 possibility of point becoming "stuck" on a tall line when
4951 scrolling by one line. */ 4948 scrolling by one line. */
4952 if (window_scroll_pixel_based_preserve_y < 0 4949 if (window_scroll_pixel_based_preserve_y < 0
4953 || NILP (Fmemq (current_kboard->Vlast_command, 4950 || !SYMBOLP (current_kboard->Vlast_command)
4954 Vscroll_preserve_screen_position_commands))) 4951 || NILP (Fget (current_kboard->Vlast_command, Qscroll_command)))
4955 { 4952 {
4956 start_display (&it, w, start); 4953 start_display (&it, w, start);
4957 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); 4954 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
4958 window_scroll_pixel_based_preserve_y = it.current_y; 4955 window_scroll_pixel_based_preserve_y = it.current_y;
4959 window_scroll_pixel_based_preserve_x = it.current_x; 4956 window_scroll_pixel_based_preserve_x = it.current_x;
5209 startpos = marker_position (w->start); 5206 startpos = marker_position (w->start);
5210 5207
5211 if (!NILP (Vscroll_preserve_screen_position)) 5208 if (!NILP (Vscroll_preserve_screen_position))
5212 { 5209 {
5213 if (window_scroll_preserve_vpos <= 0 5210 if (window_scroll_preserve_vpos <= 0
5214 || NILP (Fmemq (current_kboard->Vlast_command, 5211 || !SYMBOLP (current_kboard->Vlast_command)
5215 Vscroll_preserve_screen_position_commands))) 5212 || NILP (Fget (current_kboard->Vlast_command, Qscroll_command)))
5216 { 5213 {
5217 struct position posit 5214 struct position posit
5218 = *compute_motion (startpos, 0, 0, 0, 5215 = *compute_motion (startpos, 0, 0, 0,
5219 PT, ht, 0, 5216 PT, ht, 0,
5220 -1, XINT (w->hscroll), 5217 -1, XINT (w->hscroll),
7178 staticpro (&Qscroll_up); 7175 staticpro (&Qscroll_up);
7179 7176
7180 Qscroll_down = intern_c_string ("scroll-down"); 7177 Qscroll_down = intern_c_string ("scroll-down");
7181 staticpro (&Qscroll_down); 7178 staticpro (&Qscroll_down);
7182 7179
7180 Qscroll_command = intern_c_string ("scroll-command");
7181 staticpro (&Qscroll_command);
7182
7183 Fput (Qscroll_up, Qscroll_command, Qt);
7184 Fput (Qscroll_down, Qscroll_command, Qt);
7185
7183 Qwindow_size_fixed = intern_c_string ("window-size-fixed"); 7186 Qwindow_size_fixed = intern_c_string ("window-size-fixed");
7184 staticpro (&Qwindow_size_fixed); 7187 staticpro (&Qwindow_size_fixed);
7185 Fset (Qwindow_size_fixed, Qnil); 7188 Fset (Qwindow_size_fixed, Qnil);
7186 7189
7187 staticpro (&Qwindow_configuration_change_hook); 7190 staticpro (&Qwindow_configuration_change_hook);
7268 at the scroll margin or window boundary respectively. 7271 at the scroll margin or window boundary respectively.
7269 A value of t means point keeps its screen position if the scroll 7272 A value of t means point keeps its screen position if the scroll
7270 command moved it vertically out of the window, e.g. when scrolling 7273 command moved it vertically out of the window, e.g. when scrolling
7271 by full screens. 7274 by full screens.
7272 Any other value means point always keeps its screen position. 7275 Any other value means point always keeps its screen position.
7273 Scroll commands are defined by the variable 7276 Scroll commands should have the `scroll-command' property
7274 `scroll-preserve-screen-position-commands'. */); 7277 on their symbols to be controlled by this variable. */);
7275 Vscroll_preserve_screen_position = Qnil; 7278 Vscroll_preserve_screen_position = Qnil;
7276
7277 DEFVAR_LISP ("scroll-preserve-screen-position-commands",
7278 &Vscroll_preserve_screen_position_commands,
7279 doc: /* A list of commands whose scrolling should keep screen position unchanged.
7280 This list defines the names of scroll commands affected by the variable
7281 `scroll-preserve-screen-position'. */);
7282 Vscroll_preserve_screen_position_commands =
7283 Fcons (Qscroll_down, Fcons (Qscroll_up, Qnil));
7284 7279
7285 DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type, 7280 DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type,
7286 doc: /* Type of marker to use for `window-point'. */); 7281 doc: /* Type of marker to use for `window-point'. */);
7287 Vwindow_point_insertion_type = Qnil; 7282 Vwindow_point_insertion_type = Qnil;
7288 7283