comparison src/redisplay.c @ 48:56c54cf7c5b6 r19-16b90

Import from CVS: tag r19-16b90
author cvs
date Mon, 13 Aug 2007 08:56:04 +0200
parents 8b8b7f3559a2
children ee648375d8d6
comparison
equal deleted inserted replaced
47:11c6df210d7f 48:56c54cf7c5b6
275 int overlay_width); 275 int overlay_width);
276 static void create_right_glyph_block (struct window *w, 276 static void create_right_glyph_block (struct window *w,
277 struct display_line *dl); 277 struct display_line *dl);
278 static void regenerate_window (struct window *w, Bufpos start_pos, 278 static void regenerate_window (struct window *w, Bufpos start_pos,
279 Bufpos point, int type); 279 Bufpos point, int type);
280 static void regenerate_window_point_center (struct window *w, Bufpos point, 280 static Bufpos regenerate_window_point_center (struct window *w, Bufpos point,
281 int type); 281 int type);
282 int window_half_pixpos (struct window *w); 282 int window_half_pixpos (struct window *w);
283 int line_at_center (struct window *w, int type, Bufpos start, Bufpos point); 283 int line_at_center (struct window *w, int type, Bufpos start, Bufpos point);
284 Bufpos point_at_center (struct window *w, int type, Bufpos start, 284 Bufpos point_at_center (struct window *w, int type, Bufpos start,
285 Bufpos point); 285 Bufpos point);
286 static void redisplay_window (Lisp_Object window, int skip_selected); 286 static void redisplay_window (Lisp_Object window, int skip_selected);
4782 /* Oh, well. */ 4782 /* Oh, well. */
4783 return 0; 4783 return 0;
4784 } 4784 }
4785 4785
4786 /* Given a window and a point, update the given display lines such 4786 /* Given a window and a point, update the given display lines such
4787 that point is displayed in the middle of the window. */ 4787 that point is displayed in the middle of the window.
4788 4788 Return the window's new start position. */
4789 static void 4789
4790 static Bufpos
4790 regenerate_window_point_center (struct window *w, Bufpos point, int type) 4791 regenerate_window_point_center (struct window *w, Bufpos point, int type)
4791 { 4792 {
4792 Bufpos startp; 4793 Bufpos startp;
4793 4794
4794 /* We need to make sure that the modeline is generated so that the 4795 /* We need to make sure that the modeline is generated so that the
4797 4798
4798 startp = start_with_line_at_pixpos (w, point, window_half_pixpos (w)); 4799 startp = start_with_line_at_pixpos (w, point, window_half_pixpos (w));
4799 regenerate_window (w, startp, point, type); 4800 regenerate_window (w, startp, point, type);
4800 Fset_marker (w->start[type], make_int (startp), w->buffer); 4801 Fset_marker (w->start[type], make_int (startp), w->buffer);
4801 4802
4802 return; 4803 return startp;
4803 } 4804 }
4804 4805
4805 /* Given a window and a set of display lines, return a boolean 4806 /* Given a window and a set of display lines, return a boolean
4806 indicating whether the given point is contained within. */ 4807 indicating whether the given point is contained within. */
4807 4808
5004 /* If the marker's buffer is not the window's buffer, then we need 5005 /* If the marker's buffer is not the window's buffer, then we need
5005 to find a new starting position. */ 5006 to find a new starting position. */
5006 if (!MINI_WINDOW_P (w) 5007 if (!MINI_WINDOW_P (w)
5007 && !EQ (Fmarker_buffer (w->start[CURRENT_DISP]), w->buffer)) 5008 && !EQ (Fmarker_buffer (w->start[CURRENT_DISP]), w->buffer))
5008 { 5009 {
5009 regenerate_window_point_center (w, pointm, DESIRED_DISP); 5010 startp = regenerate_window_point_center (w, pointm, DESIRED_DISP);
5010 5011
5011 goto regeneration_done; 5012 goto regeneration_done;
5012 } 5013 }
5013 5014
5014 if (echo_active) 5015 if (echo_active)
5138 || (pointm == startp && 5139 || (pointm == startp &&
5139 EQ (Fmarker_buffer (w->last_start[CURRENT_DISP]), w->buffer) && 5140 EQ (Fmarker_buffer (w->last_start[CURRENT_DISP]), w->buffer) &&
5140 startp < marker_position (w->last_start[CURRENT_DISP])) 5141 startp < marker_position (w->last_start[CURRENT_DISP]))
5141 || (startp == BUF_ZV (b))) 5142 || (startp == BUF_ZV (b)))
5142 { 5143 {
5143 regenerate_window_point_center (w, pointm, DESIRED_DISP); 5144 startp = regenerate_window_point_center (w, pointm, DESIRED_DISP);
5144 5145
5145 goto regeneration_done; 5146 goto regeneration_done;
5146 } 5147 }
5147 /* See if we can update the data structures locally based on 5148 /* See if we can update the data structures locally based on
5148 knowledge of what changed in the buffer. */ 5149 knowledge of what changed in the buffer. */
5176 /* We still haven't gotten the window regenerated with point 5177 /* We still haven't gotten the window regenerated with point
5177 visible. Next we try scrolling a little and see if point comes 5178 visible. Next we try scrolling a little and see if point comes
5178 back onto the screen. */ 5179 back onto the screen. */
5179 if (scroll_step) 5180 if (scroll_step)
5180 { 5181 {
5181 Bufpos bufpos; 5182 startp = vmotion (w, startp,
5182
5183 bufpos = vmotion (w, startp,
5184 (pointm < startp) ? -scroll_step : scroll_step, 0); 5183 (pointm < startp) ? -scroll_step : scroll_step, 0);
5185 regenerate_window (w, bufpos, pointm, DESIRED_DISP); 5184 regenerate_window (w, startp, pointm, DESIRED_DISP);
5186 5185
5187 if (point_visible (w, pointm, DESIRED_DISP)) 5186 if (point_visible (w, pointm, DESIRED_DISP))
5188 goto regeneration_done; 5187 goto regeneration_done;
5189 } 5188 }
5190 5189
5191 /* We still haven't managed to get the screen drawn with point on 5190 /* We still haven't managed to get the screen drawn with point on
5192 the screen, so just center it and be done with it. */ 5191 the screen, so just center it and be done with it. */
5193 regenerate_window_point_center (w, pointm, DESIRED_DISP); 5192 startp = regenerate_window_point_center (w, pointm, DESIRED_DISP);
5194 5193
5195 5194
5196 regeneration_done: 5195 regeneration_done:
5197 5196
5198 /* If the window's frame is changed then reset the current display 5197 /* If the window's frame is changed then reset the current display
7517 Dynarr_atp (db->runes, 7516 Dynarr_atp (db->runes,
7518 Dynarr_length (db->runes) - 1)->bufpos; 7517 Dynarr_length (db->runes) - 1)->bufpos;
7519 else 7518 else
7520 *closest = 7519 *closest =
7521 Dynarr_atp (db->runes, 7520 Dynarr_atp (db->runes,
7522 Dynarr_length (db->runes) - 1)->bufpos; 7521 Dynarr_length (db->runes) - 2)->bufpos;
7523 } 7522 }
7524 7523
7525 if (dl->modeline) 7524 if (dl->modeline)
7526 *modeline_closest += dl->offset; 7525 *modeline_closest += dl->offset;
7527 else 7526 else