]> git.eshelyaron.com Git - emacs.git/commitdiff
(handle_single_display_prop): Handle left-fringe and
authorKim F. Storm <storm@cua.dk>
Wed, 25 Feb 2004 22:39:54 +0000 (22:39 +0000)
committerKim F. Storm <storm@cua.dk>
Wed, 25 Feb 2004 22:39:54 +0000 (22:39 +0000)
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).

src/xdisp.c

index e7b3ec20268e8e0b0f484495acedc1fc4f3c748d..a1bd50001c47f3e3661dba504858cae0021738ea 100644 (file)
@@ -3490,43 +3490,6 @@ handle_single_display_prop (it, prop, object, position,
          it->voffset = - (XFLOATINT (value)
                           * (FONT_HEIGHT (face->font)));
        }
-#endif /* HAVE_WINDOW_SYSTEM */
-    }
-  else if (CONSP (prop)
-          && (EQ (XCAR (prop), Qleft_fringe)
-              || EQ (XCAR (prop), Qright_fringe))
-          && CONSP (XCDR (prop)))
-    {
-      unsigned face_id = DEFAULT_FACE_ID;
-
-      /* `(left-fringe BITMAP FACE)'.  */
-      if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f))
-       return 0;
-
-#ifdef HAVE_WINDOW_SYSTEM
-      value = XCAR (XCDR (prop));
-      if (!NUMBERP (value)
-         || !valid_fringe_bitmap_id_p (XINT (value)))
-       return 0;
-
-      if (CONSP (XCDR (XCDR (prop))))
-       {
-         Lisp_Object face_name = XCAR (XCDR (XCDR (prop)));
-         face_id = lookup_named_face (it->f, face_name, 'A');
-         if (face_id < 0)
-           return 0;
-       }
-
-      if (EQ (XCAR (prop), Qleft_fringe))
-       {
-         it->left_user_fringe_bitmap = XINT (value);
-         it->left_user_fringe_face_id = face_id;
-       }
-      else
-       {
-         it->right_user_fringe_bitmap = XINT (value);
-         it->right_user_fringe_face_id = face_id;
-       }
 #endif /* HAVE_WINDOW_SYSTEM */
     }
   else if (!it->string_from_display_prop_p)
@@ -3547,6 +3510,64 @@ handle_single_display_prop (it, prop, object, position,
         text properties change there.  */
       it->stop_charpos = position->charpos;
 
+      if (CONSP (prop)
+         && (EQ (XCAR (prop), Qleft_fringe)
+             || EQ (XCAR (prop), Qright_fringe))
+         && CONSP (XCDR (prop)))
+       {
+         unsigned face_id = DEFAULT_FACE_ID;
+
+         /* Save current settings of IT so that we can restore them
+            when we are finished with the glyph property value.  */
+
+         /* `(left-fringe BITMAP FACE)'.  */
+         if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f))
+           return 0;
+
+#ifdef HAVE_WINDOW_SYSTEM
+         value = XCAR (XCDR (prop));
+         if (!NUMBERP (value)
+             || !valid_fringe_bitmap_id_p (XINT (value)))
+           return 0;
+
+         if (CONSP (XCDR (XCDR (prop))))
+           {
+             Lisp_Object face_name = XCAR (XCDR (XCDR (prop)));
+
+             face_id = lookup_named_face (it->f, face_name, 'A');
+             if (face_id < 0)
+               return 0;
+           }
+
+         push_it (it);
+
+         it->area = TEXT_AREA;
+         it->what = IT_IMAGE;
+         it->image_id = -1; /* no image */
+         it->position = start_pos;
+         it->object = NILP (object) ? it->w->buffer : object;
+         it->method = next_element_from_image;
+         it->face_id = face_id;
+
+         /* Say that we haven't consumed the characters with
+            `display' property yet.  The call to pop_it in
+            set_iterator_to_next will clean this up.  */
+         *position = start_pos;
+
+         if (EQ (XCAR (prop), Qleft_fringe))
+           {
+             it->left_user_fringe_bitmap = XINT (value);
+             it->left_user_fringe_face_id = face_id;
+           }
+         else
+           {
+             it->right_user_fringe_bitmap = XINT (value);
+             it->right_user_fringe_face_id = face_id;
+           }
+#endif /* HAVE_WINDOW_SYSTEM */
+         return 1;
+       }
+
       location = Qunbound;
       if (CONSP (prop) && CONSP (XCAR (prop)))
        {
@@ -17680,11 +17701,20 @@ produce_image_glyph (it)
   xassert (it->what == IT_IMAGE);
 
   face = FACE_FROM_ID (it->f, it->face_id);
+  xassert (face);
+  /* Make sure X resources of the face is loaded.  */
+  PREPARE_FACE_FOR_DISPLAY (it->f, face);
+
+  if (it->image_id < 0)
+    {
+      /* Fringe bitmap.  */
+      it->nglyphs = 0;
+      return;
+    }
+
   img = IMAGE_FROM_ID (it->f, it->image_id);
   xassert (img);
-
-  /* Make sure X resources of the face and image are loaded.  */
-  PREPARE_FACE_FOR_DISPLAY (it->f, face);
+  /* Make sure X resources of the image is loaded.  */
   prepare_image_for_display (it->f, img);
 
   it->ascent = it->phys_ascent = glyph_ascent = image_ascent (img, face);