(U+5E38): Modify ideographic-structure.
[chise/xemacs-chise.git] / src / extents.c
index 5b00161..95a059b 100644 (file)
@@ -2753,10 +2753,9 @@ invisible_ellipsis_p (REGISTER Lisp_Object propval, Lisp_Object list)
 
 face_index
 extent_fragment_update (struct window *w, struct extent_fragment *ef,
-                       Bytind pos, Lisp_Object last_glyph)
+                       Bytind pos)
 {
   int i;
-  int seen_glyph = NILP (last_glyph) ? 1 : 0;
   Extent_List *sel =
     buffer_or_string_stack_of_extents_force (ef->object)->extents;
   EXTENT lhe = 0;
@@ -2797,15 +2796,11 @@ extent_fragment_update (struct window *w, struct extent_fragment *ef,
       if (extent_start (e) == mempos && !NILP (extent_begin_glyph (e)))
        {
          Lisp_Object glyph = extent_begin_glyph (e);
-         if (seen_glyph) {
-           struct glyph_block gb;
-           
-           gb.glyph = glyph;
-           XSETEXTENT (gb.extent, e);
-           Dynarr_add (ef->begin_glyphs, gb);
-         }
-         else if (EQ (glyph, last_glyph))
-           seen_glyph = 1;
+         struct glyph_block gb;
+
+         gb.glyph = glyph;
+         XSETEXTENT (gb.extent, e);
+         Dynarr_add (ef->begin_glyphs, gb);
        }
     }
 
@@ -2816,15 +2811,11 @@ extent_fragment_update (struct window *w, struct extent_fragment *ef,
       if (extent_end (e) == mempos && !NILP (extent_end_glyph (e)))
        {
          Lisp_Object glyph = extent_end_glyph (e);
-         if (seen_glyph) {
-           struct glyph_block gb;
+         struct glyph_block gb;
 
-           gb.glyph = glyph;
-           XSETEXTENT (gb.extent, e);
-           Dynarr_add (ef->end_glyphs, gb);
-         }
-         else if (EQ (glyph, last_glyph))
-           seen_glyph = 1;
+         gb.glyph = glyph;
+         XSETEXTENT (gb.extent, e);
+         Dynarr_add (ef->end_glyphs, gb);
        }
     }
 
@@ -2959,9 +2950,9 @@ print_extent_1 (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
   if (extent_detached_p (ext))
     strcpy (bp, "detached");
   else
-    sprintf (bp, "%d, %d",
-            XINT (Fextent_start_position (obj)),
-            XINT (Fextent_end_position (obj)));
+    sprintf (bp, "%ld, %ld",
+            (long) XINT (Fextent_start_position (obj)),
+            (long) XINT (Fextent_end_position (obj)));
   bp += strlen (bp);
   *bp++ = (extent_end_open_p (anc) ? ')': ']');
   if (!NILP (extent_end_glyph (anc))) *bp++ = '*';
@@ -3852,7 +3843,6 @@ See documentation on `detach-extent' for a discussion of undo recording.
   get_buffer_or_string_range_byte (buffer_or_string, start, end, &s, &e,
                                   GB_ALLOW_PAST_ACCESSIBLE);
 
-  buffer_or_string_extent_info_force (buffer_or_string);
   set_extent_endpoints (ext, s, e, buffer_or_string);
   return extent;
 }
@@ -4584,36 +4574,27 @@ process_extents_for_insertion_mapper (EXTENT extent, void *arg)
 #endif
 
   /* The extent-adjustment code adjusted the extent's endpoints as if
-     all extents were closed-open -- endpoints at the insertion point
-     remain unchanged.  We need to fix the other kinds of extents:
-
-     1. Start position of start-open extents needs to be moved.
+     they were markers -- endpoints at the gap (i.e. the insertion
+     point) go to the left of the insertion point, which is correct
+     for [) extents.  We need to fix the other kinds of extents.
 
-     2. End position of end-closed extents needs to be moved.
-
-     Note that both conditions hold for zero-length (] extents at the
-     insertion point.  But under these rules, zero-length () extents
-     would get adjusted such that their start is greater than their
-     end; instead of allowing that, we treat them as [) extents by
-     modifying condition #1 to not fire nothing when dealing with a
-     zero-length open-open extent.
-
-     Existence of zero-length open-open extents is unfortunately an
-     inelegant part of the extent model, but there is no way around
-     it. */
+     Note that both conditions below will hold for zero-length (]
+     extents at the gap.  Zero-length () extents would get adjusted
+     such that their start is greater than their end; we treat them
+     as [) extents.  This is unfortunately an inelegant part of the
+     extent model, but there is no way around it. */
 
   {
-    Memind new_start = extent_start (extent);
-    Memind new_end   = extent_end (extent);
+    Memind new_start, new_end;
 
-    if (indice == extent_start (extent) && extent_start_open_p (extent)
-       /* zero-length () extents are exempt; see comment above. */
-       && !(new_start == new_end && extent_end_open_p (extent))
-       )
+    new_start = extent_start (extent);
+    new_end = extent_end (extent);
+    if (indice == extent_start (extent) && extent_start_open_p (extent) &&
+       /* coerce zero-length () extents to [) */
+       new_start != new_end)
       new_start += closure->length;
     if (indice == extent_end (extent) && !extent_end_open_p (extent))
       new_end += closure->length;
-
     set_extent_endpoints_1 (extent, new_start, new_end);
   }