unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: emacs-devel@gnu.org
Subject: Bugfix
Date: Thu, 28 Feb 2008 22:24:48 -0500	[thread overview]
Message-ID: <87zltkmolb.fsf@stupidchicken.com> (raw)

Joe Wells <jbw@macs.hw.ac.uk> wrote:

> BUG #1:  An overlay's after-string property that would appear at the
> end of the buffer is not displayed, if the same overlay also has a
> display property and an immediately preceding overlay also has an
> after-string property.  (Putting extra characters at the end of the
> buffer works around this bug.)

To reproduce:

  (progn
    (if (get-buffer "*test*")
	(kill-buffer "*test*"))
    (pop-to-buffer "*test*")
    (erase-buffer)
    (insert "ABCD")
    (let ((o1 (make-overlay 2 3))
	  (o2 (make-overlay 3 4))
	  (s " "))
      (overlay-put o1 'after-string "1")
      (overlay-put o1 'display s)
      (overlay-put o2 'display s)))

I believe is a pretty safe and straightforward fix, but since it's in
the redisplay engine, it'd be good if someone double-checks before I
check it into the branch.  (It's already in the trunk.)

The bug is due to an optimization in next_overlay_string that tells the
iterator to stop scanning if we're at the end of the buffer and there
are no more overlay strings to process.  This fails when there's a
display string, because it->end_charpos gives the length of the string
instead of the length of the buffer.  In this case, we simply shouldn't
set overlay_strings_at_end_processed_p.


*** emacs/src/xdisp.c.~1.1149.2.23.~	2008-02-28 20:59:38.000000000 -0500
--- emacs/src/xdisp.c	2008-02-28 22:02:16.000000000 -0500
***************
*** 4677,4683 ****
        /* If we're at the end of the buffer, record that we have
  	 processed the overlay strings there already, so that
  	 next_element_from_buffer doesn't try it again.  */
!       if (IT_CHARPOS (*it) >= it->end_charpos)
  	it->overlay_strings_at_end_processed_p = 1;
  
        /* If we have to display `...' for invisible text, set
--- 4677,4683 ----
        /* If we're at the end of the buffer, record that we have
  	 processed the overlay strings there already, so that
  	 next_element_from_buffer doesn't try it again.  */
!       if (NILP (it->string) && IT_CHARPOS (*it) >= it->end_charpos)
  	it->overlay_strings_at_end_processed_p = 1;
  
        /* If we have to display `...' for invisible text, set




                 reply	other threads:[~2008-02-29  3:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zltkmolb.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).