emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: Overlay string not displayed on text with `display'


From: Kim F. Storm
Subject: Re: address@hidden: Overlay string not displayed on text with `display' property]
Date: Thu, 15 Jun 2006 16:45:01 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

YAMAMOTO Mitsuharu <address@hidden> writes:

>>>>>> On Tue, 13 Jun 2006 13:38:14 +0200, address@hidden (Kim F. Storm) said:
>
>> Please try the new patch below.
>
> Thanks.  I tried the installed one, and found another assertion
> violation with the following case.
>
> ; emacs -Q -D
> (setq overlay (make-overlay 1 3))
> (overlay-put overlay 'before-string (propertize "BE" 'face 'bold))
> (overlay-put overlay 'after-string (propertize "AF" 'display 
>                        (propertize "XY" 'face 'underline)))
> (compose-region 1 3)

Please try the patch below.

It is a bit long, as it also fixes problems related to positioning
the cursor on a compisition glyph surrounded by overlay strings.


>
> And how is the `invisible' case supposed to work now?  If the final
> expression in the above test case is replaced with (put-text-property
> 1 3 'invisible t), the before-string remains visible but the
> after-string becomes invisible.

I don't know what TRT is.  Anybody??


*** dispextern.h        13 Jun 2006 12:42:07 +0200      1.219
--- dispextern.h        14 Jun 2006 16:40:00 +0200      
***************
*** 1932,1938 ****
      int stop_charpos;
      int face_id;
      Lisp_Object string;
!     int image_id;
      struct display_pos pos;
      int end_charpos;
      int string_nchars;
--- 1932,1948 ----
      int stop_charpos;
      int face_id;
      Lisp_Object string;
!     union {
!       struct {
!       Lisp_Object object;
!       struct it_slice slice;
!       int image_id;
!       } image;
!       struct {
!       int c, len;
!       int cmp_id, cmp_len;
!       } comp;
!     } u;
      struct display_pos pos;
      int end_charpos;
      int string_nchars;
***************
*** 1941,1947 ****
      unsigned multibyte_p : 1;
      unsigned string_from_display_prop_p : 1;
      unsigned display_ellipsis_p : 1;
-     struct it_slice slice;
      Lisp_Object space_width;
      short voffset;
      Lisp_Object font_height;
--- 1951,1956 ----


Index: xdisp.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xdisp.c,v
retrieving revision 1.1104
diff -c -r1.1104 xdisp.c
*** xdisp.c     14 Jun 2006 14:29:47 -0000      1.1104
--- xdisp.c     15 Jun 2006 14:46:09 -0000
***************
*** 4556,4561 ****
--- 4556,4562 ----
  
        pop_it (it);
        xassert (it->sp > 0
+              || it->method == GET_FROM_COMPOSITION
               || (NILP (it->string)
                   && it->method == GET_FROM_BUFFER
                   && it->stop_charpos >= BEGV
***************
*** 4903,4920 ****
    p->stop_charpos = it->stop_charpos;
    xassert (it->face_id >= 0);
    p->face_id = it->face_id;
!   p->image_id = it->image_id;
    p->method = it->method;
!   if (it->method == GET_FROM_IMAGE)
!     p->string = it->object;
!   else
!     p->string = it->string;
    p->pos = it->current;
    p->end_charpos = it->end_charpos;
    p->string_nchars = it->string_nchars;
    p->area = it->area;
    p->multibyte_p = it->multibyte_p;
-   p->slice = it->slice;
    p->space_width = it->space_width;
    p->font_height = it->font_height;
    p->voffset = it->voffset;
--- 4904,4930 ----
    p->stop_charpos = it->stop_charpos;
    xassert (it->face_id >= 0);
    p->face_id = it->face_id;
!   p->string = it->string;
    p->method = it->method;
!   switch (p->method)
!     {
!     case GET_FROM_IMAGE:
!       p->u.image.object = it->object;
!       p->u.image.image_id = it->image_id;
!       p->u.image.slice = it->slice;
!       break;
!     case GET_FROM_COMPOSITION:
!       p->u.comp.c = it->c;
!       p->u.comp.len = it->len;
!       p->u.comp.cmp_id = it->cmp_id;
!       p->u.comp.cmp_len = it->cmp_len;
!       break;
!     }
    p->pos = it->current;
    p->end_charpos = it->end_charpos;
    p->string_nchars = it->string_nchars;
    p->area = it->area;
    p->multibyte_p = it->multibyte_p;
    p->space_width = it->space_width;
    p->font_height = it->font_height;
    p->voffset = it->voffset;
***************
*** 4941,4963 ****
    p = it->stack + it->sp;
    it->stop_charpos = p->stop_charpos;
    it->face_id = p->face_id;
-   it->method = p->method;
-   it->image_id = p->image_id;
    it->current = p->pos;
!   if (it->method == GET_FROM_IMAGE)
!     {
!       it->object = it->string;
!       it->string = Qnil;
!     }
!   else
!     it->string = p->string;
    if (NILP (it->string))
      SET_TEXT_POS (it->current.string_pos, -1, -1);
    it->end_charpos = p->end_charpos;
    it->string_nchars = p->string_nchars;
    it->area = p->area;
    it->multibyte_p = p->multibyte_p;
-   it->slice = p->slice;
    it->space_width = p->space_width;
    it->font_height = p->font_height;
    it->voffset = p->voffset;
--- 4951,4983 ----
    p = it->stack + it->sp;
    it->stop_charpos = p->stop_charpos;
    it->face_id = p->face_id;
    it->current = p->pos;
!   it->string = p->string;
    if (NILP (it->string))
      SET_TEXT_POS (it->current.string_pos, -1, -1);
+   it->method = p->method;
+   switch (it->method)
+     {
+     case GET_FROM_IMAGE:
+       it->image_id = p->u.image.image_id;
+       it->object = p->u.image.object;
+       it->slice = p->u.image.slice;
+       break;
+     case GET_FROM_COMPOSITION:
+       it->c = p->u.comp.c;
+       it->len = p->u.comp.len;
+       it->cmp_id = p->u.comp.cmp_id;
+       it->cmp_len = p->u.comp.cmp_len;
+       if (STRINGP (it->string))
+       it->object = it->string;
+       else
+       it->object = it->w->buffer;
+       break;
+     }
    it->end_charpos = p->end_charpos;
    it->string_nchars = p->string_nchars;
    it->area = p->area;
    it->multibyte_p = p->multibyte_p;
    it->space_width = p->space_width;
    it->font_height = p->font_height;
    it->voffset = p->voffset;
***************
*** 5108,5142 ****
          continue;
        }
  
!       /* If newline has a display property that replaces the newline with 
something
!        else (image or text), find start of overlay or interval and continue 
search
!        from that point.  */
!       if (IT_CHARPOS (*it) > BEGV)
!       {
!         struct it it2 = *it;
!         int pos;
!         int beg, end;
!         Lisp_Object val, overlay;
! 
!         pos = --IT_CHARPOS (it2);
!         --IT_BYTEPOS (it2);
!         it2.sp = 0;
!         if (handle_display_prop (&it2) == HANDLED_RETURN
!             && !NILP (val = get_char_property_and_overlay
!                       (make_number (pos), Qdisplay, Qnil, &overlay))
!             && (OVERLAYP (overlay)
!                 ? (beg = OVERLAY_POSITION (OVERLAY_START (overlay)))
!                 : get_property_and_range (pos, Qdisplay, &val, &beg, &end, 
Qnil)))
!           {
!             if (beg < BEGV)
!               beg = BEGV;
!             IT_CHARPOS (*it) = beg;
!             IT_BYTEPOS (*it) = buf_charpos_to_bytepos (current_buffer, beg);
!             continue;
!           }
!       }
  
!       break;
      }
  
    it->continuation_lines_width = 0;
--- 5128,5170 ----
          continue;
        }
  
!       if (IT_CHARPOS (*it) <= BEGV)
!       break;
  
!       {
!       struct it it2;
!       int pos;
!       int beg, end;
!       Lisp_Object val, overlay;
! 
!       /* If newline is part of a composition, continue from start of 
composition */
!       if (find_composition (IT_CHARPOS (*it), -1, &beg, &end, &val, Qnil)
!           && beg < IT_CHARPOS (*it))
!         goto replaced;
! 
!       /* If newline is replaced by a display property, find start of overlay
!          or interval and continue search from that point.  */
!       it2 = *it;
!       pos = --IT_CHARPOS (it2);
!       --IT_BYTEPOS (it2);
!       it2.sp = 0;
!       if (handle_display_prop (&it2) == HANDLED_RETURN
!           && !NILP (val = get_char_property_and_overlay
!                     (make_number (pos), Qdisplay, Qnil, &overlay))
!           && (OVERLAYP (overlay)
!               ? (beg = OVERLAY_POSITION (OVERLAY_START (overlay)))
!               : get_property_and_range (pos, Qdisplay, &val, &beg, &end, 
Qnil)))
!         goto replaced;
! 
!       /* Newline is not replaced by anything -- so we are done.  */
!       break;
! 
!       replaced:
!       if (beg < BEGV)
!         beg = BEGV;
!       IT_CHARPOS (*it) = beg;
!       IT_BYTEPOS (*it) = buf_charpos_to_bytepos (current_buffer, beg);
!       }
      }
  
    it->continuation_lines_width = 0;
***************
*** 5272,5277 ****
--- 5300,5306 ----
    IT_STRING_BYTEPOS (*it) = -1;
    it->string = Qnil;
    it->method = GET_FROM_BUFFER;
+   it->object = it->w->buffer;
    it->area = TEXT_AREA;
    it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
    it->sp = 0;
***************
*** 5759,5764 ****
--- 5788,5794 ----
          IT_STRING_BYTEPOS (*it) += it->len;
          IT_STRING_CHARPOS (*it) += it->cmp_len;
          it->method = GET_FROM_STRING;
+         it->object = it->string;
          goto consider_string_end;
        }
        else
***************
*** 5766,5771 ****
--- 5796,5802 ----
          IT_BYTEPOS (*it) += it->len;
          IT_CHARPOS (*it) += it->cmp_len;
          it->method = GET_FROM_BUFFER;
+         it->object = it->w->buffer;
        }
        break;
  
***************
*** 5795,5801 ****
          else if (STRINGP (it->string))
            it->method = GET_FROM_STRING;
          else
!           it->method = GET_FROM_BUFFER;
  
          it->dpvec = NULL;
          it->current.dpvec_index = -1;
--- 5826,5835 ----
          else if (STRINGP (it->string))
            it->method = GET_FROM_STRING;
          else
!           {
!             it->method = GET_FROM_BUFFER;
!             it->object = it->w->buffer;
!           }
  
          it->dpvec = NULL;
          it->current.dpvec_index = -1;
***************
*** 6080,6085 ****
--- 6114,6120 ----
         setting face_before_selective_p.  */
        it->saved_face_id = it->face_id;
        it->method = GET_FROM_BUFFER;
+       it->object = it->w->buffer;
        reseat_at_next_visible_line_start (it, 1);
        it->face_before_selective_p = 1;
      }
***************
*** 6268,6273 ****
--- 6303,6310 ----
                  : it->current.pos);
    if (STRINGP (it->string))
      it->object = it->string;
+   else
+     it->object = it->w->buffer;
    return 1;
  }
  


-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

[Prev in Thread] Current Thread [Next in Thread]