emacs-devel
[Top][All Lists]
Advanced

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

Re: Point stuck with adjacent overlays and invisibility spec


From: Chong Yidong
Subject: Re: Point stuck with adjacent overlays and invisibility spec
Date: Sat, 04 Mar 2006 12:38:47 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>   (progn
>     (pop-to-buffer (get-buffer-create "*foo*"))
>     (erase-buffer)
>     (insert "1234567")
>     (goto-char (point-min))
>     (add-to-invisibility-spec '(outline . t))
>     (let ((ov1 (make-overlay 4 5))
>           (ov2 (make-overlay 5 6)))
>       (overlay-put ov1 'display "xxx")
>       (overlay-put ov2 'invisible 'outline)))
>
> With point on 1, do C-f.  When point reaches 4, I get a Lisp error:
>
>   Debugger entered--Lisp error: (args-out-of-range 5 5)
>
> with no backtrace.  The buffer's redisplay then becomes screwed up.

I debugged some more.  The error comes from the call to
Fget_char_property in set_cursor_from_row.  The trouble is that at
position 5, which is both the end of the display-string overlay and
the start of the invisibility overlay, glyph->charpos is a buffer
position while glyph->object is a string (the display string).  This
is bad, because glyph->charpos should be a string position
when glyph->object is a string.

The mixup seems to come from handle_invisible_prop, which
updates it->position but not it->object.  The following patch should
fix this.  If no one objects, I'll commit it soon.

*** emacs/src/xdisp.c.~1.1076.~ 2006-03-04 12:23:30.000000000 -0500
--- emacs/src/xdisp.c   2006-03-04 12:24:28.000000000 -0500
***************
*** 3702,3707 ****
--- 3702,3708 ----
    if (it->saved_face_id < 0 || it->saved_face_id != it->face_id)
      it->saved_face_id = it->face_id = DEFAULT_FACE_ID;
  
+   it->object = Qnil;
    it->method = GET_FROM_DISPLAY_VECTOR;
    it->ellipsis_p = 1;
  }




reply via email to

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