Mercurial > emacs
comparison src/xdisp.c @ 90084:befae6bafecb
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-6
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-48
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-51
Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 24 Jan 2005 22:34:31 +0000 |
parents | 6d92d69fae33 4712d3f43248 |
children | f8a7a9ba3d08 |
comparison
equal
deleted
inserted
replaced
90083:2b2f720892ae | 90084:befae6bafecb |
---|---|
1257 struct window *w; | 1257 struct window *w; |
1258 int charpos, *x, *y, *rtop, *rbot, exact_mode_line_heights_p; | 1258 int charpos, *x, *y, *rtop, *rbot, exact_mode_line_heights_p; |
1259 { | 1259 { |
1260 struct it it; | 1260 struct it it; |
1261 struct text_pos top; | 1261 struct text_pos top; |
1262 int visible_p; | 1262 int visible_p = 0; |
1263 struct buffer *old_buffer = NULL; | 1263 struct buffer *old_buffer = NULL; |
1264 | |
1265 if (noninteractive) | |
1266 return visible_p; | |
1264 | 1267 |
1265 if (XBUFFER (w->buffer) != current_buffer) | 1268 if (XBUFFER (w->buffer) != current_buffer) |
1266 { | 1269 { |
1267 old_buffer = current_buffer; | 1270 old_buffer = current_buffer; |
1268 set_buffer_internal_1 (XBUFFER (w->buffer)); | 1271 set_buffer_internal_1 (XBUFFER (w->buffer)); |
1269 } | 1272 } |
1270 | 1273 |
1271 visible_p = 0; | |
1272 SET_TEXT_POS_FROM_MARKER (top, w->start); | 1274 SET_TEXT_POS_FROM_MARKER (top, w->start); |
1273 | 1275 |
1274 /* Compute exact mode line heights, if requested. */ | 1276 /* Compute exact mode line heights, if requested. */ |
1275 if (exact_mode_line_heights_p) | 1277 if (exact_mode_line_heights_p) |
1276 { | 1278 { |
1291 | 1293 |
1292 /* Note that we may overshoot because of invisible text. */ | 1294 /* Note that we may overshoot because of invisible text. */ |
1293 if (IT_CHARPOS (it) >= charpos) | 1295 if (IT_CHARPOS (it) >= charpos) |
1294 { | 1296 { |
1295 int top_y = it.current_y; | 1297 int top_y = it.current_y; |
1296 int bottom_y = line_bottom_y (&it); | 1298 int bottom_y = (last_height = 0, line_bottom_y (&it)); |
1297 int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w); | 1299 int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w); |
1298 | 1300 |
1299 if (top_y < window_top_y) | 1301 if (top_y < window_top_y) |
1300 visible_p = bottom_y > window_top_y; | 1302 visible_p = bottom_y > window_top_y; |
1301 else if (top_y < it.last_visible_y) | 1303 else if (top_y < it.last_visible_y) |
1302 visible_p = 1; | 1304 visible_p = 1; |
1303 if (visible_p && x) | 1305 if (visible_p && x) |
1304 { | 1306 { |
1305 *x = it.current_x; | 1307 *x = it.current_x; |
1306 *y = max (top_y + it.max_ascent - it.ascent, window_top_y); | 1308 *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y); |
1307 if (rtop) | 1309 if (rtop) |
1308 { | 1310 { |
1309 *rtop = max (0, window_top_y - top_y); | 1311 *rtop = max (0, window_top_y - top_y); |
1310 *rbot = max (0, bottom_y - it.last_visible_y); | 1312 *rbot = max (0, bottom_y - it.last_visible_y); |
1311 } | 1313 } |
1784 /* This is a text line that may be partially visible. */ | 1786 /* This is a text line that may be partially visible. */ |
1785 r.x = window_box_left (s->w, s->area); | 1787 r.x = window_box_left (s->w, s->area); |
1786 r.width = window_box_width (s->w, s->area); | 1788 r.width = window_box_width (s->w, s->area); |
1787 r.height = s->row->visible_height; | 1789 r.height = s->row->visible_height; |
1788 } | 1790 } |
1791 | |
1792 if (s->clip_head) | |
1793 if (r.x < s->clip_head->x) | |
1794 { | |
1795 if (r.width >= s->clip_head->x - r.x) | |
1796 r.width -= s->clip_head->x - r.x; | |
1797 else | |
1798 r.width = 0; | |
1799 r.x = s->clip_head->x; | |
1800 } | |
1801 if (s->clip_tail) | |
1802 if (r.x + r.width > s->clip_tail->x + s->clip_tail->background_width) | |
1803 { | |
1804 if (s->clip_tail->x + s->clip_tail->background_width >= r.x) | |
1805 r.width = s->clip_tail->x + s->clip_tail->background_width - r.x; | |
1806 else | |
1807 r.width = 0; | |
1808 } | |
1789 | 1809 |
1790 /* If S draws overlapping rows, it's sufficient to use the top and | 1810 /* If S draws overlapping rows, it's sufficient to use the top and |
1791 bottom of the window for clipping because this glyph string | 1811 bottom of the window for clipping because this glyph string |
1792 intentionally draws over other lines. */ | 1812 intentionally draws over other lines. */ |
1793 if (s->for_overlaps_p) | 1813 if (s->for_overlaps_p) |
6503 move_it_to (&it2, start_charpos, -1, -1, -1, MOVE_TO_POS); | 6523 move_it_to (&it2, start_charpos, -1, -1, -1, MOVE_TO_POS); |
6504 it->vpos -= it2.vpos; | 6524 it->vpos -= it2.vpos; |
6505 it->current_y -= it2.current_y; | 6525 it->current_y -= it2.current_y; |
6506 it->current_x = it->hpos = 0; | 6526 it->current_x = it->hpos = 0; |
6507 | 6527 |
6508 /* If we moved too far, move IT some lines forward. */ | 6528 /* If we moved too far back, move IT some lines forward. */ |
6509 if (it2.vpos > -dvpos) | 6529 if (it2.vpos > -dvpos) |
6510 { | 6530 { |
6511 int delta = it2.vpos + dvpos; | 6531 int delta = it2.vpos + dvpos; |
6532 it2 = *it; | |
6512 move_it_to (it, -1, -1, -1, it->vpos + delta, MOVE_TO_VPOS); | 6533 move_it_to (it, -1, -1, -1, it->vpos + delta, MOVE_TO_VPOS); |
6534 /* Move back again if we got too far ahead. */ | |
6535 if (IT_CHARPOS (*it) >= start_charpos) | |
6536 *it = it2; | |
6513 } | 6537 } |
6514 } | 6538 } |
6515 } | 6539 } |
6516 | 6540 |
6517 /* Return 1 if IT points into the middle of a display vector. */ | 6541 /* Return 1 if IT points into the middle of a display vector. */ |
12330 } | 12354 } |
12331 | 12355 |
12332 /* If centering point failed to make the whole line visible, | 12356 /* If centering point failed to make the whole line visible, |
12333 put point at the top instead. That has to make the whole line | 12357 put point at the top instead. That has to make the whole line |
12334 visible, if it can be done. */ | 12358 visible, if it can be done. */ |
12359 if (centering_position == 0) | |
12360 goto done; | |
12335 clear_glyph_matrix (w->desired_matrix); | 12361 clear_glyph_matrix (w->desired_matrix); |
12336 centering_position = 0; | 12362 centering_position = 0; |
12337 goto point_at_top; | 12363 goto point_at_top; |
12338 } | 12364 } |
12339 | 12365 |
18336 enum draw_glyphs_face hl; | 18362 enum draw_glyphs_face hl; |
18337 int overlaps_p; | 18363 int overlaps_p; |
18338 { | 18364 { |
18339 struct glyph_string *head, *tail; | 18365 struct glyph_string *head, *tail; |
18340 struct glyph_string *s; | 18366 struct glyph_string *s; |
18367 struct glyph_string *clip_head = NULL, *clip_tail = NULL; | |
18341 int last_x, area_width; | 18368 int last_x, area_width; |
18342 int x_reached; | 18369 int x_reached; |
18343 int i, j; | 18370 int i, j; |
18344 struct frame *f = XFRAME (WINDOW_FRAME (w)); | 18371 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
18345 DECLARE_HDC (hdc); | 18372 DECLARE_HDC (hdc); |
18404 BUILD_GLYPH_STRINGS (j, start, h, t, | 18431 BUILD_GLYPH_STRINGS (j, start, h, t, |
18405 DRAW_NORMAL_TEXT, dummy_x, last_x); | 18432 DRAW_NORMAL_TEXT, dummy_x, last_x); |
18406 start = i; | 18433 start = i; |
18407 compute_overhangs_and_x (t, head->x, 1); | 18434 compute_overhangs_and_x (t, head->x, 1); |
18408 prepend_glyph_string_lists (&head, &tail, h, t); | 18435 prepend_glyph_string_lists (&head, &tail, h, t); |
18436 clip_head = head; | |
18409 } | 18437 } |
18410 | 18438 |
18411 /* Prepend glyph strings for glyphs in front of the first glyph | 18439 /* Prepend glyph strings for glyphs in front of the first glyph |
18412 string that overwrite that glyph string because of their | 18440 string that overwrite that glyph string because of their |
18413 right overhang. For these strings, only the foreground must | 18441 right overhang. For these strings, only the foreground must |
18416 right overhangs of preceding glyphs for which no glyph | 18444 right overhangs of preceding glyphs for which no glyph |
18417 strings exist. */ | 18445 strings exist. */ |
18418 i = left_overwriting (head); | 18446 i = left_overwriting (head); |
18419 if (i >= 0) | 18447 if (i >= 0) |
18420 { | 18448 { |
18449 clip_head = head; | |
18421 BUILD_GLYPH_STRINGS (i, start, h, t, | 18450 BUILD_GLYPH_STRINGS (i, start, h, t, |
18422 DRAW_NORMAL_TEXT, dummy_x, last_x); | 18451 DRAW_NORMAL_TEXT, dummy_x, last_x); |
18423 for (s = h; s; s = s->next) | 18452 for (s = h; s; s = s->next) |
18424 s->background_filled_p = 1; | 18453 s->background_filled_p = 1; |
18425 compute_overhangs_and_x (t, head->x, 1); | 18454 compute_overhangs_and_x (t, head->x, 1); |
18435 { | 18464 { |
18436 BUILD_GLYPH_STRINGS (end, i, h, t, | 18465 BUILD_GLYPH_STRINGS (end, i, h, t, |
18437 DRAW_NORMAL_TEXT, x, last_x); | 18466 DRAW_NORMAL_TEXT, x, last_x); |
18438 compute_overhangs_and_x (h, tail->x + tail->width, 0); | 18467 compute_overhangs_and_x (h, tail->x + tail->width, 0); |
18439 append_glyph_string_lists (&head, &tail, h, t); | 18468 append_glyph_string_lists (&head, &tail, h, t); |
18469 clip_tail = tail; | |
18440 } | 18470 } |
18441 | 18471 |
18442 /* Append glyph strings for glyphs following the last glyph | 18472 /* Append glyph strings for glyphs following the last glyph |
18443 string tail that overwrite tail. The foreground of such | 18473 string tail that overwrite tail. The foreground of such |
18444 glyphs has to be drawn because it writes into the background | 18474 glyphs has to be drawn because it writes into the background |
18445 of tail. The background must not be drawn because it could | 18475 of tail. The background must not be drawn because it could |
18446 paint over the foreground of following glyphs. */ | 18476 paint over the foreground of following glyphs. */ |
18447 i = right_overwriting (tail); | 18477 i = right_overwriting (tail); |
18448 if (i >= 0) | 18478 if (i >= 0) |
18449 { | 18479 { |
18480 clip_tail = tail; | |
18450 BUILD_GLYPH_STRINGS (end, i, h, t, | 18481 BUILD_GLYPH_STRINGS (end, i, h, t, |
18451 DRAW_NORMAL_TEXT, x, last_x); | 18482 DRAW_NORMAL_TEXT, x, last_x); |
18452 for (s = h; s; s = s->next) | 18483 for (s = h; s; s = s->next) |
18453 s->background_filled_p = 1; | 18484 s->background_filled_p = 1; |
18454 compute_overhangs_and_x (h, tail->x + tail->width, 0); | 18485 compute_overhangs_and_x (h, tail->x + tail->width, 0); |
18455 append_glyph_string_lists (&head, &tail, h, t); | 18486 append_glyph_string_lists (&head, &tail, h, t); |
18456 } | 18487 } |
18488 if (clip_head || clip_tail) | |
18489 for (s = head; s; s = s->next) | |
18490 { | |
18491 s->clip_head = clip_head; | |
18492 s->clip_tail = clip_tail; | |
18493 } | |
18457 } | 18494 } |
18458 | 18495 |
18459 /* Draw all strings. */ | 18496 /* Draw all strings. */ |
18460 for (s = head; s; s = s->next) | 18497 for (s = head; s; s = s->next) |
18461 rif->draw_glyph_string (s); | 18498 rif->draw_glyph_string (s); |
18465 /* When drawing overlapping rows, only the glyph strings' | 18502 /* When drawing overlapping rows, only the glyph strings' |
18466 foreground is drawn, which doesn't erase a cursor | 18503 foreground is drawn, which doesn't erase a cursor |
18467 completely. */ | 18504 completely. */ |
18468 && !overlaps_p) | 18505 && !overlaps_p) |
18469 { | 18506 { |
18470 int x0 = head ? head->x : x; | 18507 int x0 = clip_head ? clip_head->x : (head ? head->x : x); |
18471 int x1 = tail ? tail->x + tail->background_width : x; | 18508 int x1 = (clip_tail ? clip_tail->x + clip_tail->background_width |
18509 : (tail ? tail->x + tail->background_width : x)); | |
18472 | 18510 |
18473 int text_left = window_box_left (w, TEXT_AREA); | 18511 int text_left = window_box_left (w, TEXT_AREA); |
18474 x0 -= text_left; | 18512 x0 -= text_left; |
18475 x1 -= text_left; | 18513 x1 -= text_left; |
18476 | 18514 |