unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: Point stuck with adjacent overlays and invisibility spec
@ 2006-03-01  5:05 Chong Yidong
  2006-03-04 17:38 ` Chong Yidong
  0 siblings, 1 reply; 3+ messages in thread
From: Chong Yidong @ 2006-03-01  5:05 UTC (permalink / raw)


(This is based on Ralf Angeli's bug report of Feb 21)

The problem seems to be that adjust_point_for_property fails when we
have invisible text with ellipsis immediately after a 'display string.
I modified Ralf's test case slightly:

  (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))

This creates a buffer with the contents 1234567, where 4 is overlaid
with the display string "xxx" and 5 is invisible with an ellispis:

123xxx...67

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.

Everything works as expected if we use '(outline . nil) for the
invisiblity spec, i.e. with no ellipsis.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Point stuck with adjacent overlays and invisibility spec
  2006-03-01  5:05 Point stuck with adjacent overlays and invisibility spec Chong Yidong
@ 2006-03-04 17:38 ` Chong Yidong
  2006-03-06  0:50   ` Richard Stallman
  0 siblings, 1 reply; 3+ messages in thread
From: Chong Yidong @ 2006-03-04 17:38 UTC (permalink / raw)


>   (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;
  }

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Point stuck with adjacent overlays and invisibility spec
  2006-03-04 17:38 ` Chong Yidong
@ 2006-03-06  0:50   ` Richard Stallman
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Stallman @ 2006-03-06  0:50 UTC (permalink / raw)
  Cc: emacs-devel

Thanks for fixing this.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-03-06  0:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-01  5:05 Point stuck with adjacent overlays and invisibility spec Chong Yidong
2006-03-04 17:38 ` Chong Yidong
2006-03-06  0:50   ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).