Mercurial > emacs
comparison src/xdisp.c @ 83061:bff8fa30c018
Merged in changes from CVS HEAD
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-113
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-114
Merge some minor redisplay bug-fixes from emacs--tiling--0
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-115
Update from CVS
* miles@gnu.org--gnu-2004/emacs--tiling--0--patch-9
Remove bogus xassert
* miles@gnu.org--gnu-2004/emacs--tiling--0--patch-10
Avoid negative descents for images with ascent > height
* miles@gnu.org--gnu-2004/emacs--tiling--0--patch-13
Fix iterator-inconsistency bug in redisplay
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-101
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Thu, 26 Feb 2004 00:39:34 +0000 |
parents | 968e8c7ff1f4 02b649742717 |
children | b1f57ac99be5 |
comparison
equal
deleted
inserted
replaced
83060:70063cb10ca9 | 83061:bff8fa30c018 |
---|---|
1898 if (it->method == next_element_from_string) | 1898 if (it->method == next_element_from_string) |
1899 { | 1899 { |
1900 xassert (STRINGP (it->string)); | 1900 xassert (STRINGP (it->string)); |
1901 xassert (IT_STRING_CHARPOS (*it) >= 0); | 1901 xassert (IT_STRING_CHARPOS (*it) >= 0); |
1902 } | 1902 } |
1903 else if (it->method == next_element_from_buffer) | 1903 else |
1904 { | 1904 { |
1905 /* Check that character and byte positions agree. */ | 1905 xassert (IT_STRING_CHARPOS (*it) < 0); |
1906 xassert (IT_CHARPOS (*it) == BYTE_TO_CHAR (IT_BYTEPOS (*it))); | 1906 if (it->method == next_element_from_buffer) |
1907 { | |
1908 /* Check that character and byte positions agree. */ | |
1909 xassert (IT_CHARPOS (*it) == BYTE_TO_CHAR (IT_BYTEPOS (*it))); | |
1910 } | |
1907 } | 1911 } |
1908 | 1912 |
1909 if (it->dpvec) | 1913 if (it->dpvec) |
1910 xassert (it->current.dpvec_index >= 0); | 1914 xassert (it->current.dpvec_index >= 0); |
1911 else | 1915 else |
2014 /* Clear IT. */ | 2018 /* Clear IT. */ |
2015 bzero (it, sizeof *it); | 2019 bzero (it, sizeof *it); |
2016 it->current.overlay_string_index = -1; | 2020 it->current.overlay_string_index = -1; |
2017 it->current.dpvec_index = -1; | 2021 it->current.dpvec_index = -1; |
2018 it->base_face_id = base_face_id; | 2022 it->base_face_id = base_face_id; |
2023 it->string = Qnil; | |
2024 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = -1; | |
2019 | 2025 |
2020 /* The window in which we iterate over current_buffer: */ | 2026 /* The window in which we iterate over current_buffer: */ |
2021 XSETWINDOW (it->window, w); | 2027 XSETWINDOW (it->window, w); |
2022 it->w = w; | 2028 it->w = w; |
2023 it->f = XFRAME (w->frame); | 2029 it->f = XFRAME (w->frame); |
3480 it->voffset = - (XFLOATINT (value) | 3486 it->voffset = - (XFLOATINT (value) |
3481 * (FONT_HEIGHT (face->font))); | 3487 * (FONT_HEIGHT (face->font))); |
3482 } | 3488 } |
3483 #endif /* HAVE_WINDOW_SYSTEM */ | 3489 #endif /* HAVE_WINDOW_SYSTEM */ |
3484 } | 3490 } |
3485 else if (CONSP (prop) | |
3486 && (EQ (XCAR (prop), Qleft_fringe) | |
3487 || EQ (XCAR (prop), Qright_fringe)) | |
3488 && CONSP (XCDR (prop))) | |
3489 { | |
3490 unsigned face_id = DEFAULT_FACE_ID; | |
3491 | |
3492 /* `(left-fringe BITMAP FACE)'. */ | |
3493 if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | |
3494 return 0; | |
3495 | |
3496 #ifdef HAVE_WINDOW_SYSTEM | |
3497 value = XCAR (XCDR (prop)); | |
3498 if (!NUMBERP (value) | |
3499 || !valid_fringe_bitmap_id_p (XINT (value))) | |
3500 return 0; | |
3501 | |
3502 if (CONSP (XCDR (XCDR (prop)))) | |
3503 { | |
3504 Lisp_Object face_name = XCAR (XCDR (XCDR (prop))); | |
3505 face_id = lookup_named_face (it->f, face_name, 'A'); | |
3506 if (face_id < 0) | |
3507 return 0; | |
3508 } | |
3509 | |
3510 if (EQ (XCAR (prop), Qleft_fringe)) | |
3511 { | |
3512 it->left_user_fringe_bitmap = XINT (value); | |
3513 it->left_user_fringe_face_id = face_id; | |
3514 } | |
3515 else | |
3516 { | |
3517 it->right_user_fringe_bitmap = XINT (value); | |
3518 it->right_user_fringe_face_id = face_id; | |
3519 } | |
3520 #endif /* HAVE_WINDOW_SYSTEM */ | |
3521 } | |
3522 else if (!it->string_from_display_prop_p) | 3491 else if (!it->string_from_display_prop_p) |
3523 { | 3492 { |
3524 /* `((margin left-margin) VALUE)' or `((margin right-margin) | 3493 /* `((margin left-margin) VALUE)' or `((margin right-margin) |
3525 VALUE) or `((margin nil) VALUE)' or VALUE. */ | 3494 VALUE) or `((margin nil) VALUE)' or VALUE. */ |
3526 Lisp_Object location, value; | 3495 Lisp_Object location, value; |
3534 value = Qnil; | 3503 value = Qnil; |
3535 | 3504 |
3536 /* Let's stop at the new position and assume that all | 3505 /* Let's stop at the new position and assume that all |
3537 text properties change there. */ | 3506 text properties change there. */ |
3538 it->stop_charpos = position->charpos; | 3507 it->stop_charpos = position->charpos; |
3508 | |
3509 if (CONSP (prop) | |
3510 && (EQ (XCAR (prop), Qleft_fringe) | |
3511 || EQ (XCAR (prop), Qright_fringe)) | |
3512 && CONSP (XCDR (prop))) | |
3513 { | |
3514 unsigned face_id = DEFAULT_FACE_ID; | |
3515 | |
3516 /* Save current settings of IT so that we can restore them | |
3517 when we are finished with the glyph property value. */ | |
3518 | |
3519 /* `(left-fringe BITMAP FACE)'. */ | |
3520 if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | |
3521 return 0; | |
3522 | |
3523 #ifdef HAVE_WINDOW_SYSTEM | |
3524 value = XCAR (XCDR (prop)); | |
3525 if (!NUMBERP (value) | |
3526 || !valid_fringe_bitmap_id_p (XINT (value))) | |
3527 return 0; | |
3528 | |
3529 if (CONSP (XCDR (XCDR (prop)))) | |
3530 { | |
3531 Lisp_Object face_name = XCAR (XCDR (XCDR (prop))); | |
3532 | |
3533 face_id = lookup_named_face (it->f, face_name, 'A'); | |
3534 if (face_id < 0) | |
3535 return 0; | |
3536 } | |
3537 | |
3538 push_it (it); | |
3539 | |
3540 it->area = TEXT_AREA; | |
3541 it->what = IT_IMAGE; | |
3542 it->image_id = -1; /* no image */ | |
3543 it->position = start_pos; | |
3544 it->object = NILP (object) ? it->w->buffer : object; | |
3545 it->method = next_element_from_image; | |
3546 it->face_id = face_id; | |
3547 | |
3548 /* Say that we haven't consumed the characters with | |
3549 `display' property yet. The call to pop_it in | |
3550 set_iterator_to_next will clean this up. */ | |
3551 *position = start_pos; | |
3552 | |
3553 if (EQ (XCAR (prop), Qleft_fringe)) | |
3554 { | |
3555 it->left_user_fringe_bitmap = XINT (value); | |
3556 it->left_user_fringe_face_id = face_id; | |
3557 } | |
3558 else | |
3559 { | |
3560 it->right_user_fringe_bitmap = XINT (value); | |
3561 it->right_user_fringe_face_id = face_id; | |
3562 } | |
3563 #endif /* HAVE_WINDOW_SYSTEM */ | |
3564 return 1; | |
3565 } | |
3539 | 3566 |
3540 location = Qunbound; | 3567 location = Qunbound; |
3541 if (CONSP (prop) && CONSP (XCAR (prop))) | 3568 if (CONSP (prop) && CONSP (XCAR (prop))) |
3542 { | 3569 { |
3543 Lisp_Object tem; | 3570 Lisp_Object tem; |
17671 int face_ascent, glyph_ascent; | 17698 int face_ascent, glyph_ascent; |
17672 | 17699 |
17673 xassert (it->what == IT_IMAGE); | 17700 xassert (it->what == IT_IMAGE); |
17674 | 17701 |
17675 face = FACE_FROM_ID (it->f, it->face_id); | 17702 face = FACE_FROM_ID (it->f, it->face_id); |
17703 xassert (face); | |
17704 /* Make sure X resources of the face is loaded. */ | |
17705 PREPARE_FACE_FOR_DISPLAY (it->f, face); | |
17706 | |
17707 if (it->image_id < 0) | |
17708 { | |
17709 /* Fringe bitmap. */ | |
17710 it->nglyphs = 0; | |
17711 return; | |
17712 } | |
17713 | |
17676 img = IMAGE_FROM_ID (it->f, it->image_id); | 17714 img = IMAGE_FROM_ID (it->f, it->image_id); |
17677 xassert (img); | 17715 xassert (img); |
17678 | 17716 /* Make sure X resources of the image is loaded. */ |
17679 /* Make sure X resources of the face and image are loaded. */ | |
17680 PREPARE_FACE_FOR_DISPLAY (it->f, face); | |
17681 prepare_image_for_display (it->f, img); | 17717 prepare_image_for_display (it->f, img); |
17682 | 17718 |
17683 it->ascent = it->phys_ascent = glyph_ascent = image_ascent (img, face); | 17719 it->ascent = it->phys_ascent = glyph_ascent = image_ascent (img, face); |
17684 it->descent = it->phys_descent = img->height + 2 * img->vmargin - it->ascent; | 17720 it->descent = it->phys_descent = img->height + 2 * img->vmargin - it->ascent; |
17685 it->pixel_width = img->width + 2 * img->hmargin; | 17721 it->pixel_width = img->width + 2 * img->hmargin; |
17722 | |
17723 /* It's quite possible for images to have an ascent greater than | |
17724 their height, so don't get confused in that case. */ | |
17725 if (it->descent < 0) | |
17726 it->descent = 0; | |
17686 | 17727 |
17687 /* If this glyph is alone on the last line, adjust it.ascent to minimum row ascent. */ | 17728 /* If this glyph is alone on the last line, adjust it.ascent to minimum row ascent. */ |
17688 face_ascent = face->font ? FONT_BASE (face->font) : FRAME_BASELINE_OFFSET (it->f); | 17729 face_ascent = face->font ? FONT_BASE (face->font) : FRAME_BASELINE_OFFSET (it->f); |
17689 if (face_ascent > it->ascent) | 17730 if (face_ascent > it->ascent) |
17690 it->ascent = it->phys_ascent = face_ascent; | 17731 it->ascent = it->phys_ascent = face_ascent; |