comparison src/xdisp.c @ 36285:df398b248a30

(handle_single_display_prop): Add parameter DISPLAY_REPLACED_BEFORE_P. If it is non-zero ignore display properties which replace the display of text with something else. (handle_display_prop): Call handle_single_display_prop with additional argument saying if we already replaced text display with something else. Use AREF. (with_echo_area_buffer_unwind_data, display_menu_bar) (decode_mode_spec_coding): Use AREF and ASIZE.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 22 Feb 2001 13:25:41 +0000
parents 54f26d21b7a7
children ce84015c0c41
comparison
equal deleted inserted replaced
36284:57b4ef5b9089 36285:df398b248a30
761 static void compute_string_pos P_ ((struct text_pos *, struct text_pos, 761 static void compute_string_pos P_ ((struct text_pos *, struct text_pos,
762 Lisp_Object)); 762 Lisp_Object));
763 static int face_before_or_after_it_pos P_ ((struct it *, int)); 763 static int face_before_or_after_it_pos P_ ((struct it *, int));
764 static int next_overlay_change P_ ((int)); 764 static int next_overlay_change P_ ((int));
765 static int handle_single_display_prop P_ ((struct it *, Lisp_Object, 765 static int handle_single_display_prop P_ ((struct it *, Lisp_Object,
766 Lisp_Object, struct text_pos *)); 766 Lisp_Object, struct text_pos *,
767 int));
767 static int underlying_face_id P_ ((struct it *)); 768 static int underlying_face_id P_ ((struct it *));
768 769
769 #define face_before_it_pos(IT) face_before_or_after_it_pos ((IT), 1) 770 #define face_before_it_pos(IT) face_before_or_after_it_pos ((IT), 1)
770 #define face_after_it_pos(IT) face_before_or_after_it_pos ((IT), 0) 771 #define face_after_it_pos(IT) face_before_or_after_it_pos ((IT), 0)
771 772
2558 handle_display_prop (it) 2559 handle_display_prop (it)
2559 struct it *it; 2560 struct it *it;
2560 { 2561 {
2561 Lisp_Object prop, object; 2562 Lisp_Object prop, object;
2562 struct text_pos *position; 2563 struct text_pos *position;
2563 int space_or_image_found_p; 2564 int display_replaced_p = 0;
2564 2565
2565 if (STRINGP (it->string)) 2566 if (STRINGP (it->string))
2566 { 2567 {
2567 object = it->string; 2568 object = it->string;
2568 position = &it->current.string_pos; 2569 position = &it->current.string_pos;
2587 prop = Fget_char_property (make_number (position->charpos), 2588 prop = Fget_char_property (make_number (position->charpos),
2588 Qdisplay, object); 2589 Qdisplay, object);
2589 if (NILP (prop)) 2590 if (NILP (prop))
2590 return HANDLED_NORMALLY; 2591 return HANDLED_NORMALLY;
2591 2592
2592 space_or_image_found_p = 0;
2593 if (CONSP (prop) 2593 if (CONSP (prop)
2594 && CONSP (XCAR (prop)) 2594 && CONSP (XCAR (prop))
2595 && !EQ (Qmargin, XCAR (XCAR (prop)))) 2595 && !EQ (Qmargin, XCAR (XCAR (prop))))
2596 { 2596 {
2597 /* A list of sub-properties. */ 2597 /* A list of sub-properties. */
2598 while (CONSP (prop)) 2598 for (; CONSP (prop); prop = XCDR (prop))
2599 { 2599 {
2600 if (handle_single_display_prop (it, XCAR (prop), object, position)) 2600 if (handle_single_display_prop (it, XCAR (prop), object,
2601 space_or_image_found_p = 1; 2601 position, display_replaced_p))
2602 prop = XCDR (prop); 2602 display_replaced_p = 1;
2603 } 2603 }
2604 } 2604 }
2605 else if (VECTORP (prop)) 2605 else if (VECTORP (prop))
2606 { 2606 {
2607 int i; 2607 int i;
2608 for (i = 0; i < XVECTOR (prop)->size; ++i) 2608 for (i = 0; i < ASIZE (prop); ++i)
2609 if (handle_single_display_prop (it, XVECTOR (prop)->contents[i], 2609 if (handle_single_display_prop (it, AREF (prop, i), object,
2610 object, position)) 2610 position, display_replaced_p))
2611 space_or_image_found_p = 1; 2611 display_replaced_p = 1;
2612 } 2612 }
2613 else 2613 else
2614 { 2614 {
2615 if (handle_single_display_prop (it, prop, object, position)) 2615 if (handle_single_display_prop (it, prop, object, position, 0))
2616 space_or_image_found_p = 1; 2616 display_replaced_p = 1;
2617 } 2617 }
2618 2618
2619 return space_or_image_found_p ? HANDLED_RETURN : HANDLED_NORMALLY; 2619 return display_replaced_p ? HANDLED_RETURN : HANDLED_NORMALLY;
2620 } 2620 }
2621 2621
2622 2622
2623 /* Value is the position of the end of the `display' property starting 2623 /* Value is the position of the end of the `display' property starting
2624 at START_POS in OBJECT. */ 2624 at START_POS in OBJECT. */
2644 } 2644 }
2645 2645
2646 2646
2647 /* Set up IT from a single `display' sub-property value PROP. OBJECT 2647 /* Set up IT from a single `display' sub-property value PROP. OBJECT
2648 is the object in which the `display' property was found. *POSITION 2648 is the object in which the `display' property was found. *POSITION
2649 is the position at which it was found. 2649 is the position at which it was found. DISPLAY_REPLACED_P non-zero
2650 means that we previously saw a display sub-property which already
2651 replaced text display with something else, for example an image;
2652 ignore such properties after the first one has been processed.
2650 2653
2651 If PROP is a `space' or `image' sub-property, set *POSITION to the 2654 If PROP is a `space' or `image' sub-property, set *POSITION to the
2652 end position of the `display' property. 2655 end position of the `display' property.
2653 2656
2654 Value is non-zero if a `space' or `image' property value was found. */ 2657 Value is non-zero something was found which replaces the display
2658 of buffer or string text. */
2655 2659
2656 static int 2660 static int
2657 handle_single_display_prop (it, prop, object, position) 2661 handle_single_display_prop (it, prop, object, position,
2662 display_replaced_before_p)
2658 struct it *it; 2663 struct it *it;
2659 Lisp_Object prop; 2664 Lisp_Object prop;
2660 Lisp_Object object; 2665 Lisp_Object object;
2661 struct text_pos *position; 2666 struct text_pos *position;
2667 int display_replaced_before_p;
2662 { 2668 {
2663 Lisp_Object value; 2669 Lisp_Object value;
2664 int space_or_image_found_p = 0; 2670 int replaces_text_display_p = 0;
2665 Lisp_Object form; 2671 Lisp_Object form;
2666 2672
2667 /* If PROP is a list of the form `(when FORM . VALUE)', FORM is 2673 /* If PROP is a list of the form `(when FORM . VALUE)', FORM is
2668 evaluated. If the result is nil, VALUE is ignored. */ 2674 evaluated. If the result is nil, VALUE is ignored. */
2669 form = Qt; 2675 form = Qt;
2852 #endif /* not HAVE_WINDOW_SYSTEM */ 2858 #endif /* not HAVE_WINDOW_SYSTEM */
2853 2859
2854 if ((EQ (location, Qleft_margin) 2860 if ((EQ (location, Qleft_margin)
2855 || EQ (location, Qright_margin) 2861 || EQ (location, Qright_margin)
2856 || NILP (location)) 2862 || NILP (location))
2857 && valid_p) 2863 && valid_p
2858 { 2864 && !display_replaced_before_p)
2859 space_or_image_found_p = 1; 2865 {
2866 replaces_text_display_p = 1;
2860 2867
2861 /* Save current settings of IT so that we can restore them 2868 /* Save current settings of IT so that we can restore them
2862 when we are finished with the glyph property value. */ 2869 when we are finished with the glyph property value. */
2863 push_it (it); 2870 push_it (it);
2864 2871
2911 /* Invalid property or property not supported. Restore 2918 /* Invalid property or property not supported. Restore
2912 the position to what it was before. */ 2919 the position to what it was before. */
2913 *position = start_pos; 2920 *position = start_pos;
2914 } 2921 }
2915 2922
2916 return space_or_image_found_p; 2923 return replaces_text_display_p;
2917 } 2924 }
2918 2925
2919 2926
2920 /* Check if PROP is a display sub-property value whose text should be 2927 /* Check if PROP is a display sub-property value whose text should be
2921 treated as intangible. */ 2928 treated as intangible. */
2976 } 2983 }
2977 else if (VECTORP (prop)) 2984 else if (VECTORP (prop))
2978 { 2985 {
2979 /* A vector of sub-properties. */ 2986 /* A vector of sub-properties. */
2980 int i; 2987 int i;
2981 for (i = 0; i < XVECTOR (prop)->size; ++i) 2988 for (i = 0; i < ASIZE (prop); ++i)
2982 if (single_display_prop_intangible_p (XVECTOR (prop)->contents[i])) 2989 if (single_display_prop_intangible_p (AREF (prop, i)))
2983 return 1; 2990 return 1;
2984 } 2991 }
2985 else 2992 else
2986 return single_display_prop_intangible_p (prop); 2993 return single_display_prop_intangible_p (prop);
2987 2994
5972 Vwith_echo_area_save_vector = Qnil; 5979 Vwith_echo_area_save_vector = Qnil;
5973 5980
5974 if (NILP (vector)) 5981 if (NILP (vector))
5975 vector = Fmake_vector (make_number (7), Qnil); 5982 vector = Fmake_vector (make_number (7), Qnil);
5976 5983
5977 XSETBUFFER (XVECTOR (vector)->contents[i], current_buffer); ++i; 5984 XSETBUFFER (AREF (vector, i), current_buffer); ++i;
5978 XVECTOR (vector)->contents[i++] = Vdeactivate_mark; 5985 AREF (vector, i) = Vdeactivate_mark, ++i;
5979 XVECTOR (vector)->contents[i++] = make_number (windows_or_buffers_changed); 5986 AREF (vector, i) = make_number (windows_or_buffers_changed), ++i;
5980 5987
5981 if (w) 5988 if (w)
5982 { 5989 {
5983 XSETWINDOW (XVECTOR (vector)->contents[i], w); ++i; 5990 XSETWINDOW (AREF (vector, i), w); ++i;
5984 XVECTOR (vector)->contents[i++] = w->buffer; 5991 AREF (vector, i) = w->buffer; ++i;
5985 XVECTOR (vector)->contents[i++] 5992 AREF (vector, i) = make_number (XMARKER (w->pointm)->charpos); ++i;
5986 = make_number (XMARKER (w->pointm)->charpos); 5993 AREF (vector, i) = make_number (XMARKER (w->pointm)->bytepos); ++i;
5987 XVECTOR (vector)->contents[i++]
5988 = make_number (XMARKER (w->pointm)->bytepos);
5989 } 5994 }
5990 else 5995 else
5991 { 5996 {
5992 int end = i + 4; 5997 int end = i + 4;
5993 while (i < end) 5998 for (; i < end; ++i)
5994 XVECTOR (vector)->contents[i++] = Qnil; 5999 AREF (vector, i) = Qnil;
5995 } 6000 }
5996 6001
5997 xassert (i == XVECTOR (vector)->size); 6002 xassert (i == ASIZE (vector));
5998 return vector; 6003 return vector;
5999 } 6004 }
6000 6005
6001 6006
6002 /* Restore global state from VECTOR which was created by 6007 /* Restore global state from VECTOR which was created by
12662 for (i = 0; i < XVECTOR (items)->size; i += 4) 12667 for (i = 0; i < XVECTOR (items)->size; i += 4)
12663 { 12668 {
12664 Lisp_Object string; 12669 Lisp_Object string;
12665 12670
12666 /* Stop at nil string. */ 12671 /* Stop at nil string. */
12667 string = XVECTOR (items)->contents[i + 1]; 12672 string = AREF (items, i + 1);
12668 if (NILP (string)) 12673 if (NILP (string))
12669 break; 12674 break;
12670 12675
12671 /* Remember where item was displayed. */ 12676 /* Remember where item was displayed. */
12672 XSETFASTINT (XVECTOR (items)->contents[i + 3], it.hpos); 12677 AREF (items, i + 3) = make_number (it.hpos);
12673 12678
12674 /* Display the item, pad with one space. */ 12679 /* Display the item, pad with one space. */
12675 if (it.current_x < it.last_visible_x) 12680 if (it.current_x < it.last_visible_x)
12676 display_string (NULL, string, Qnil, 0, 0, &it, 12681 display_string (NULL, string, Qnil, 0, 0, &it,
12677 XSTRING (string)->size + 1, 0, 0, -1); 12682 XSTRING (string)->size + 1, 0, 0, -1);
13195 Lisp_Object eolvalue; 13200 Lisp_Object eolvalue;
13196 13201
13197 eolvalue = Fget (coding_system, Qeol_type); 13202 eolvalue = Fget (coding_system, Qeol_type);
13198 13203
13199 if (multibyte) 13204 if (multibyte)
13200 *buf++ = XFASTINT (XVECTOR (val)->contents[1]); 13205 *buf++ = XFASTINT (AREF (val, 1));
13201 13206
13202 if (eol_flag) 13207 if (eol_flag)
13203 { 13208 {
13204 /* The EOL conversion that is normal on this system. */ 13209 /* The EOL conversion that is normal on this system. */
13205 13210