GNU bug report logs - #10903
24.0.93; redisplay glitch with before-string and display overlays

Previous Next

Package: emacs;

Reported by: Stephen Berman <stephen.berman <at> gmx.net>

Date: Mon, 27 Feb 2012 22:08:02 UTC

Severity: normal

Found in version 24.0.93

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 10903 in the body.
You can then email your comments to 10903 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#10903; Package emacs. (Mon, 27 Feb 2012 22:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stephen Berman <stephen.berman <at> gmx.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 27 Feb 2012 22:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.93; redisplay glitch with before-string and display overlays
Date: Mon, 27 Feb 2012 23:04:03 +0100
1. emacs -Q

2. Type `C-x b a RET' to get a fresh buffer in Fundamental mode, and  at
(point-min) type "012".

3. Type `M-<' so that the cursor is over (i.e. just before) `0'.

4. Type `M-: (overlay-put (make-overlay (point) (point)) 'before-string
"*")'.  Now you see this:

*012

5. Type `M-: (overlay-put (make-overlay (point) (1+ (point))) 'display
"")'.  Now you see this:

*12

6. Type `M-: (remove-overlays)' to restore "012".

7. Type SPC to advance the cursor and the start of "012" to column one.

8. Repeat step 4.  Now you see this:

 *012

9. Repeat step 5.  Now you see this:

 *112

According to my tests, this redisplay glitch happens when the overlays
begin anywhere other than (point-min).  It also only happens when the
before-string overlay is added prior to the display string overlay, and
only when the value of the display string is "".  I don't know when this
problem appeared, but it does not happen in Emacs 23.3.


In GNU Emacs 24.0.93.1 (i686-suse-linux-gnu, GTK+ Version 2.24.7)
 of 2012-02-26 on escher
Windowing system distributor `The X.Org Foundation', version 11.0.11004000
Configured using:
 `configure '--without-toolkit-scroll-bars' 'CFLAGS=-g''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10903; Package emacs. (Tue, 28 Feb 2012 22:03:01 GMT) Full text and rfc822 format available.

Message #8 received at 10903 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 10903 <at> debbugs.gnu.org
Subject: Re: bug#10903: 24.0.93;
	redisplay glitch with before-string and display overlays
Date: Tue, 28 Feb 2012 22:40:17 +0200
> From: Stephen Berman <stephen.berman <at> gmx.net>
> Date: Mon, 27 Feb 2012 23:04:03 +0100
> 
> 1. emacs -Q
> 
> 2. Type `C-x b a RET' to get a fresh buffer in Fundamental mode, and  at
> (point-min) type "012".
> 
> 3. Type `M-<' so that the cursor is over (i.e. just before) `0'.
> 
> 4. Type `M-: (overlay-put (make-overlay (point) (point)) 'before-string
> "*")'.  Now you see this:
> 
> *012
> 
> 5. Type `M-: (overlay-put (make-overlay (point) (1+ (point))) 'display
> "")'.  Now you see this:
> 
> *12
> 
> 6. Type `M-: (remove-overlays)' to restore "012".
> 
> 7. Type SPC to advance the cursor and the start of "012" to column one.
> 
> 8. Repeat step 4.  Now you see this:
> 
>  *012
> 
> 9. Repeat step 5.  Now you see this:
> 
>  *112

We were hitting on an old redisplay optimization that didn't play well
with the bidi-aware display engine.

I think I fixed this.  Thanks for such a clear-cut test case.

Since Savannah is on the move, I cannot commit the fix, but perhaps
you could test it locally and see if there are any leftovers.  Here's
the patch:

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2012-02-12 09:46:33 +0000
+++ src/xdisp.c	2012-02-28 20:35:41 +0000
@@ -5156,6 +5156,10 @@ next_overlay_string (struct it *it)
       it->current.overlay_string_index = -1;
       it->n_overlay_strings = 0;
       it->overlay_strings_charpos = -1;
+      /* If there's an empty display string on the stack, pop the
+	 stack, to resync the bidi iterator with IT's position.  */
+      if (it->sp > 0 && STRINGP (it->string) && !SCHARS (it->string))
+	pop_it (it);
 
       /* If we're at the end of the buffer, record that we have
 	 processed the overlay strings there already, so that
@@ -5453,8 +5457,15 @@ get_overlay_strings_1 (struct it *it, EM
       xassert (!compute_stop_p || it->sp == 0);
 
       /* When called from handle_stop, there might be an empty display
-         string loaded.  In that case, don't bother saving it.  */
-      if (!STRINGP (it->string) || SCHARS (it->string))
+         string loaded.  In that case, don't bother saving it.  But
+         don't use this optimization with the bidi iterator, since we
+         need the corresponding pop_it call to resync the bidi
+         iterator's position with IT's position, after we are done
+         with the overlay strings.  (The corresponding call to pop_it
+         in case of an empty display string is in
+         next_overlay_string.)  */
+      if (!(!it->bidi_p
+	    && STRINGP (it->string) && !SCHARS (it->string)))
 	push_it (it, NULL);
 
       /* Set up IT to deliver display elements from the first overlay






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10903; Package emacs. (Tue, 28 Feb 2012 22:26:02 GMT) Full text and rfc822 format available.

Message #11 received at 10903 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 10903 <at> debbugs.gnu.org
Subject: Re: bug#10903: 24.0.93;
	redisplay glitch with before-string and display overlays
Date: Tue, 28 Feb 2012 23:25:13 +0100
On Tue, 28 Feb 2012 22:40:17 +0200 Eli Zaretskii <eliz <at> gnu.org> wrote:

>> From: Stephen Berman <stephen.berman <at> gmx.net>
>> Date: Mon, 27 Feb 2012 23:04:03 +0100
>> 
>> 1. emacs -Q
>> 
>> 2. Type `C-x b a RET' to get a fresh buffer in Fundamental mode, and  at
>> (point-min) type "012".
>> 
>> 3. Type `M-<' so that the cursor is over (i.e. just before) `0'.
>> 
>> 4. Type `M-: (overlay-put (make-overlay (point) (point)) 'before-string
>> "*")'.  Now you see this:
>> 
>> *012
>> 
>> 5. Type `M-: (overlay-put (make-overlay (point) (1+ (point))) 'display
>> "")'.  Now you see this:
>> 
>> *12
>> 
>> 6. Type `M-: (remove-overlays)' to restore "012".
>> 
>> 7. Type SPC to advance the cursor and the start of "012" to column one.
>> 
>> 8. Repeat step 4.  Now you see this:
>> 
>>  *012
>> 
>> 9. Repeat step 5.  Now you see this:
>> 
>>  *112
>
> We were hitting on an old redisplay optimization that didn't play well
> with the bidi-aware display engine.
>
> I think I fixed this.  Thanks for such a clear-cut test case.
>
> Since Savannah is on the move, I cannot commit the fix, but perhaps
> you could test it locally and see if there are any leftovers.  Here's
> the patch:

I applied the patch and rebuilt, and the redisplay glitches I observed
are gone; thanks very much for the quick fix!  I consider this bug
resolved, but it should probably be closed after the fix is committed to
the trunk.  Thanks again.

Steve Berman




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Wed, 29 Feb 2012 17:51:02 GMT) Full text and rfc822 format available.

Notification sent to Stephen Berman <stephen.berman <at> gmx.net>:
bug acknowledged by developer. (Wed, 29 Feb 2012 17:51:02 GMT) Full text and rfc822 format available.

Message #16 received at 10903-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 10903-done <at> debbugs.gnu.org
Subject: Re: bug#10903: 24.0.93;
	redisplay glitch with before-string and display overlays
Date: Wed, 29 Feb 2012 19:52:17 +0200
> From: Stephen Berman <stephen.berman <at> gmx.net>
> Cc: 10903 <at> debbugs.gnu.org
> Date: Tue, 28 Feb 2012 23:25:13 +0100
> 
> > Since Savannah is on the move, I cannot commit the fix, but perhaps
> > you could test it locally and see if there are any leftovers.  Here's
> > the patch:
> 
> I applied the patch and rebuilt, and the redisplay glitches I observed
> are gone; thanks very much for the quick fix!  I consider this bug
> resolved, but it should probably be closed after the fix is committed to
> the trunk.  Thanks again.

Thanks for testing.  I committed the fix (revision 107465 on the
trunk) and closed the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 29 Mar 2012 11:24:02 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 39 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.