diff options
| author | Jim Blandy | 1993-05-14 14:44:01 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-05-14 14:44:01 +0000 |
| commit | f6b98e0be9be1c213281df3edf774b3ae909afa4 (patch) | |
| tree | 1f01f373b0d2c33452b7d2251e72db2a1999921c /src | |
| parent | 04a759c81b944287c3a826eed57ee56a3bea5c03 (diff) | |
| download | emacs-f6b98e0be9be1c213281df3edf774b3ae909afa4.tar.gz emacs-f6b98e0be9be1c213281df3edf774b3ae909afa4.zip | |
* xfaces.c (compute_char_face): When merging the overlays,
traverse sortvec, not overlay_vec; the latter isn't the one we
sorted.
* xfaces.c (intern_face): If the face has a GC, but it's not the
default or modeline face, abort. Nothing but those two faces
should have a GC *and* be passed to intern_face.
(compute_char_face, compute_glyph_face): After copying
the frame's default face into face, to use as a base case for
calculation, set the `gc' member to zero; that way we don't have
things lying around that look like display faces but aren't.
* xfaces.c (intern_frame_face): When copying the new face into the
frame's face array, remember that the number of bytes to copy is
sizeof (*new_face), not sizeof (new_face).
* xfaces.c (compute_char_face): Assume that W is displaying the
current buffer. Abort if it isn't.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfaces.c | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index 12756206a65..a876828da82 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -246,12 +246,6 @@ intern_face (f, face) | |||
| 246 | struct frame *f; | 246 | struct frame *f; |
| 247 | struct face *face; | 247 | struct face *face; |
| 248 | { | 248 | { |
| 249 | struct face *result; | ||
| 250 | |||
| 251 | /* Does the face have a GC already? */ | ||
| 252 | if (face->gc) | ||
| 253 | return face; | ||
| 254 | |||
| 255 | /* If it's equivalent to the default face, use that. */ | 249 | /* If it's equivalent to the default face, use that. */ |
| 256 | if (face_eql (face, FRAME_DEFAULT_FACE (f))) | 250 | if (face_eql (face, FRAME_DEFAULT_FACE (f))) |
| 257 | { | 251 | { |
| @@ -268,6 +262,10 @@ intern_face (f, face) | |||
| 268 | return FRAME_MODE_LINE_FACE (f); | 262 | return FRAME_MODE_LINE_FACE (f); |
| 269 | } | 263 | } |
| 270 | 264 | ||
| 265 | /* If it's not one of the frame's default faces, it shouldn't have a GC. */ | ||
| 266 | if (face->gc) | ||
| 267 | abort (); | ||
| 268 | |||
| 271 | /* Get a specialized display face. */ | 269 | /* Get a specialized display face. */ |
| 272 | return get_cached_face (f, face); | 270 | return get_cached_face (f, face); |
| 273 | } | 271 | } |
| @@ -539,7 +537,7 @@ intern_frame_face (frame, new_face) | |||
| 539 | i = next_face_id++; | 537 | i = next_face_id++; |
| 540 | 538 | ||
| 541 | ensure_face_ready (frame, i); | 539 | ensure_face_ready (frame, i); |
| 542 | bcopy (new_face, FRAME_FACES (frame)[i], sizeof (new_face)); | 540 | bcopy (new_face, FRAME_FACES (frame)[i], sizeof (*new_face)); |
| 543 | 541 | ||
| 544 | return i; | 542 | return i; |
| 545 | } | 543 | } |
| @@ -617,7 +615,8 @@ sort_overlays (s1, s2) | |||
| 617 | /* Return the face ID associated with a buffer position POS. | 615 | /* Return the face ID associated with a buffer position POS. |
| 618 | Store into *ENDPTR the position at which a different face is needed. | 616 | Store into *ENDPTR the position at which a different face is needed. |
| 619 | This does not take account of glyphs that specify their own face codes. | 617 | This does not take account of glyphs that specify their own face codes. |
| 620 | F is the frame in use for display, and W is the window. */ | 618 | F is the frame in use for display, and W is a window displaying |
| 619 | the current buffer. */ | ||
| 621 | int | 620 | int |
| 622 | compute_char_face (f, w, pos, endptr) | 621 | compute_char_face (f, w, pos, endptr) |
| 623 | struct frame *f; | 622 | struct frame *f; |
| @@ -629,14 +628,21 @@ compute_char_face (f, w, pos, endptr) | |||
| 629 | Lisp_Object prop, position; | 628 | Lisp_Object prop, position; |
| 630 | int i, j, noverlays; | 629 | int i, j, noverlays; |
| 631 | int facecode; | 630 | int facecode; |
| 632 | int endpos = BUF_ZV (XBUFFER (w->buffer)); | ||
| 633 | Lisp_Object *overlay_vec; | 631 | Lisp_Object *overlay_vec; |
| 634 | int len; | 632 | int len; |
| 635 | struct sortvec *sortvec; | 633 | struct sortvec *sortvec; |
| 636 | Lisp_Object frame; | 634 | Lisp_Object frame; |
| 635 | int endpos; | ||
| 636 | |||
| 637 | /* W must display the current buffer. We could write this function | ||
| 638 | to use the frame and buffer of W, but right now it doesn't. */ | ||
| 639 | if (XBUFFER (w->buffer) != current_buffer) | ||
| 640 | abort (); | ||
| 637 | 641 | ||
| 638 | XSET (frame, Lisp_Frame, f); | 642 | XSET (frame, Lisp_Frame, f); |
| 639 | 643 | ||
| 644 | endpos = ZV; | ||
| 645 | |||
| 640 | XFASTINT (position) = pos; | 646 | XFASTINT (position) = pos; |
| 641 | prop = Fget_text_property (position, Qface, w->buffer); | 647 | prop = Fget_text_property (position, Qface, w->buffer); |
| 642 | { | 648 | { |
| @@ -648,13 +654,13 @@ compute_char_face (f, w, pos, endptr) | |||
| 648 | } | 654 | } |
| 649 | 655 | ||
| 650 | { | 656 | { |
| 651 | int end; | 657 | int next_overlay; |
| 652 | 658 | ||
| 653 | len = 10; | 659 | len = 10; |
| 654 | overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object)); | 660 | overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object)); |
| 655 | noverlays = overlays_at (pos, &overlay_vec, &len, &end); | 661 | noverlays = overlays_at (pos, &overlay_vec, &len, &next_overlay); |
| 656 | if (end < endpos) | 662 | if (next_overlay < endpos) |
| 657 | endpos = end; | 663 | endpos = next_overlay; |
| 658 | } | 664 | } |
| 659 | 665 | ||
| 660 | *endptr = endpos; | 666 | *endptr = endpos; |
| @@ -664,6 +670,7 @@ compute_char_face (f, w, pos, endptr) | |||
| 664 | return 0; | 670 | return 0; |
| 665 | 671 | ||
| 666 | bcopy (FRAME_DEFAULT_FACE (f), &face, sizeof (struct face)); | 672 | bcopy (FRAME_DEFAULT_FACE (f), &face, sizeof (struct face)); |
| 673 | face.gc = 0; | ||
| 667 | 674 | ||
| 668 | if (!NILP (prop)) | 675 | if (!NILP (prop)) |
| 669 | { | 676 | { |
| @@ -689,7 +696,8 @@ compute_char_face (f, w, pos, endptr) | |||
| 689 | 696 | ||
| 690 | /* Also ignore overlays limited to one window | 697 | /* Also ignore overlays limited to one window |
| 691 | if it's not the window we are using. */ | 698 | if it's not the window we are using. */ |
| 692 | if (NILP (window) || XWINDOW (window) == w) | 699 | if (XTYPE (window) != Lisp_Window |
| 700 | || XWINDOW (window) == w) | ||
| 693 | { | 701 | { |
| 694 | Lisp_Object tem; | 702 | Lisp_Object tem; |
| 695 | 703 | ||
| @@ -714,10 +722,9 @@ compute_char_face (f, w, pos, endptr) | |||
| 714 | qsort (sortvec, noverlays, sizeof (struct sortvec), sort_overlays); | 722 | qsort (sortvec, noverlays, sizeof (struct sortvec), sort_overlays); |
| 715 | 723 | ||
| 716 | /* Now merge the overlay data in that order. */ | 724 | /* Now merge the overlay data in that order. */ |
| 717 | |||
| 718 | for (i = 0; i < noverlays; i++) | 725 | for (i = 0; i < noverlays; i++) |
| 719 | { | 726 | { |
| 720 | prop = Foverlay_get (overlay_vec[i], Qface); | 727 | prop = Foverlay_get (sortvec[i].overlay, Qface); |
| 721 | if (!NILP (prop)) | 728 | if (!NILP (prop)) |
| 722 | { | 729 | { |
| 723 | Lisp_Object oend; | 730 | Lisp_Object oend; |
| @@ -728,9 +735,9 @@ compute_char_face (f, w, pos, endptr) | |||
| 728 | && FRAME_FACES (f) [facecode] != 0) | 735 | && FRAME_FACES (f) [facecode] != 0) |
| 729 | merge_faces (FRAME_FACES (f) [facecode], &face); | 736 | merge_faces (FRAME_FACES (f) [facecode], &face); |
| 730 | 737 | ||
| 731 | oend = OVERLAY_END (overlay_vec[i]); | 738 | oend = OVERLAY_END (sortvec[i].overlay); |
| 732 | oendpos = OVERLAY_POSITION (oend); | 739 | oendpos = OVERLAY_POSITION (oend); |
| 733 | if (oendpos > endpos) | 740 | if (oendpos < endpos) |
| 734 | endpos = oendpos; | 741 | endpos = oendpos; |
| 735 | } | 742 | } |
| 736 | } | 743 | } |
| @@ -753,6 +760,7 @@ compute_glyph_face (f, face_code) | |||
| 753 | struct face face; | 760 | struct face face; |
| 754 | 761 | ||
| 755 | bcopy (FRAME_DEFAULT_FACE (f), &face, sizeof (face)); | 762 | bcopy (FRAME_DEFAULT_FACE (f), &face, sizeof (face)); |
| 763 | face.gc = 0; | ||
| 756 | 764 | ||
| 757 | if (face_code >= 0 && face_code < FRAME_N_FACES (f) | 765 | if (face_code >= 0 && face_code < FRAME_N_FACES (f) |
| 758 | && FRAME_FACES (f) [face_code] != 0) | 766 | && FRAME_FACES (f) [face_code] != 0) |