diff options
| author | Kim F. Storm | 2004-02-25 22:39:54 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2004-02-25 22:39:54 +0000 |
| commit | dd341dd9c2dfa102585d11d0ad773c0ff074507f (patch) | |
| tree | 037d9187b26b66cf029958c9aaafbcb08a7de62b /src | |
| parent | 446f5f3d0992b2e0d95c2249af0ca3a00f818657 (diff) | |
| download | emacs-dd341dd9c2dfa102585d11d0ad773c0ff074507f.tar.gz emacs-dd341dd9c2dfa102585d11d0ad773c0ff074507f.zip | |
(handle_single_display_prop): Handle left-fringe and
right-fringe similar to a display margin image. Specifically,
the characters having the fringe prop are no longer shown, and
we use IT_IMAGE/next_element_from_image with image_id = -1 to
do this. Set fringe bitmap face_id in it->face_id.
(produce_image_glyph): Handle image_id < 0 as "no image" case, but
still realize it->face (i.e. the fringe bitmap face).
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 110 |
1 files changed, 70 insertions, 40 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index e7b3ec20268..a1bd50001c4 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -3492,43 +3492,6 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3492 | } | 3492 | } |
| 3493 | #endif /* HAVE_WINDOW_SYSTEM */ | 3493 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 3494 | } | 3494 | } |
| 3495 | else if (CONSP (prop) | ||
| 3496 | && (EQ (XCAR (prop), Qleft_fringe) | ||
| 3497 | || EQ (XCAR (prop), Qright_fringe)) | ||
| 3498 | && CONSP (XCDR (prop))) | ||
| 3499 | { | ||
| 3500 | unsigned face_id = DEFAULT_FACE_ID; | ||
| 3501 | |||
| 3502 | /* `(left-fringe BITMAP FACE)'. */ | ||
| 3503 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | ||
| 3504 | return 0; | ||
| 3505 | |||
| 3506 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 3507 | value = XCAR (XCDR (prop)); | ||
| 3508 | if (!NUMBERP (value) | ||
| 3509 | || !valid_fringe_bitmap_id_p (XINT (value))) | ||
| 3510 | return 0; | ||
| 3511 | |||
| 3512 | if (CONSP (XCDR (XCDR (prop)))) | ||
| 3513 | { | ||
| 3514 | Lisp_Object face_name = XCAR (XCDR (XCDR (prop))); | ||
| 3515 | face_id = lookup_named_face (it->f, face_name, 'A'); | ||
| 3516 | if (face_id < 0) | ||
| 3517 | return 0; | ||
| 3518 | } | ||
| 3519 | |||
| 3520 | if (EQ (XCAR (prop), Qleft_fringe)) | ||
| 3521 | { | ||
| 3522 | it->left_user_fringe_bitmap = XINT (value); | ||
| 3523 | it->left_user_fringe_face_id = face_id; | ||
| 3524 | } | ||
| 3525 | else | ||
| 3526 | { | ||
| 3527 | it->right_user_fringe_bitmap = XINT (value); | ||
| 3528 | it->right_user_fringe_face_id = face_id; | ||
| 3529 | } | ||
| 3530 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3531 | } | ||
| 3532 | else if (!it->string_from_display_prop_p) | 3495 | else if (!it->string_from_display_prop_p) |
| 3533 | { | 3496 | { |
| 3534 | /* `((margin left-margin) VALUE)' or `((margin right-margin) | 3497 | /* `((margin left-margin) VALUE)' or `((margin right-margin) |
| @@ -3547,6 +3510,64 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3547 | text properties change there. */ | 3510 | text properties change there. */ |
| 3548 | it->stop_charpos = position->charpos; | 3511 | it->stop_charpos = position->charpos; |
| 3549 | 3512 | ||
| 3513 | if (CONSP (prop) | ||
| 3514 | && (EQ (XCAR (prop), Qleft_fringe) | ||
| 3515 | || EQ (XCAR (prop), Qright_fringe)) | ||
| 3516 | && CONSP (XCDR (prop))) | ||
| 3517 | { | ||
| 3518 | unsigned face_id = DEFAULT_FACE_ID; | ||
| 3519 | |||
| 3520 | /* Save current settings of IT so that we can restore them | ||
| 3521 | when we are finished with the glyph property value. */ | ||
| 3522 | |||
| 3523 | /* `(left-fringe BITMAP FACE)'. */ | ||
| 3524 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | ||
| 3525 | return 0; | ||
| 3526 | |||
| 3527 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 3528 | value = XCAR (XCDR (prop)); | ||
| 3529 | if (!NUMBERP (value) | ||
| 3530 | || !valid_fringe_bitmap_id_p (XINT (value))) | ||
| 3531 | return 0; | ||
| 3532 | |||
| 3533 | if (CONSP (XCDR (XCDR (prop)))) | ||
| 3534 | { | ||
| 3535 | Lisp_Object face_name = XCAR (XCDR (XCDR (prop))); | ||
| 3536 | |||
| 3537 | face_id = lookup_named_face (it->f, face_name, 'A'); | ||
| 3538 | if (face_id < 0) | ||
| 3539 | return 0; | ||
| 3540 | } | ||
| 3541 | |||
| 3542 | push_it (it); | ||
| 3543 | |||
| 3544 | it->area = TEXT_AREA; | ||
| 3545 | it->what = IT_IMAGE; | ||
| 3546 | it->image_id = -1; /* no image */ | ||
| 3547 | it->position = start_pos; | ||
| 3548 | it->object = NILP (object) ? it->w->buffer : object; | ||
| 3549 | it->method = next_element_from_image; | ||
| 3550 | it->face_id = face_id; | ||
| 3551 | |||
| 3552 | /* Say that we haven't consumed the characters with | ||
| 3553 | `display' property yet. The call to pop_it in | ||
| 3554 | set_iterator_to_next will clean this up. */ | ||
| 3555 | *position = start_pos; | ||
| 3556 | |||
| 3557 | if (EQ (XCAR (prop), Qleft_fringe)) | ||
| 3558 | { | ||
| 3559 | it->left_user_fringe_bitmap = XINT (value); | ||
| 3560 | it->left_user_fringe_face_id = face_id; | ||
| 3561 | } | ||
| 3562 | else | ||
| 3563 | { | ||
| 3564 | it->right_user_fringe_bitmap = XINT (value); | ||
| 3565 | it->right_user_fringe_face_id = face_id; | ||
| 3566 | } | ||
| 3567 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3568 | return 1; | ||
| 3569 | } | ||
| 3570 | |||
| 3550 | location = Qunbound; | 3571 | location = Qunbound; |
| 3551 | if (CONSP (prop) && CONSP (XCAR (prop))) | 3572 | if (CONSP (prop) && CONSP (XCAR (prop))) |
| 3552 | { | 3573 | { |
| @@ -17680,11 +17701,20 @@ produce_image_glyph (it) | |||
| 17680 | xassert (it->what == IT_IMAGE); | 17701 | xassert (it->what == IT_IMAGE); |
| 17681 | 17702 | ||
| 17682 | face = FACE_FROM_ID (it->f, it->face_id); | 17703 | face = FACE_FROM_ID (it->f, it->face_id); |
| 17704 | xassert (face); | ||
| 17705 | /* Make sure X resources of the face is loaded. */ | ||
| 17706 | PREPARE_FACE_FOR_DISPLAY (it->f, face); | ||
| 17707 | |||
| 17708 | if (it->image_id < 0) | ||
| 17709 | { | ||
| 17710 | /* Fringe bitmap. */ | ||
| 17711 | it->nglyphs = 0; | ||
| 17712 | return; | ||
| 17713 | } | ||
| 17714 | |||
| 17683 | img = IMAGE_FROM_ID (it->f, it->image_id); | 17715 | img = IMAGE_FROM_ID (it->f, it->image_id); |
| 17684 | xassert (img); | 17716 | xassert (img); |
| 17685 | 17717 | /* Make sure X resources of the image is loaded. */ | |
| 17686 | /* Make sure X resources of the face and image are loaded. */ | ||
| 17687 | PREPARE_FACE_FOR_DISPLAY (it->f, face); | ||
| 17688 | prepare_image_for_display (it->f, img); | 17718 | prepare_image_for_display (it->f, img); |
| 17689 | 17719 | ||
| 17690 | it->ascent = it->phys_ascent = glyph_ascent = image_ascent (img, face); | 17720 | it->ascent = it->phys_ascent = glyph_ascent = image_ascent (img, face); |