From: Eli Zaretskii <eliz@gnu.org>
To: Stephen Berman <stephen.berman@gmx.net>
Cc: 10903@debbugs.gnu.org
Subject: bug#10903: 24.0.93; redisplay glitch with before-string and display overlays
Date: Tue, 28 Feb 2012 22:40:17 +0200 [thread overview]
Message-ID: <831upeelou.fsf@gnu.org> (raw)
In-Reply-To: <87pqd0hr1o.fsf@escher.home>
> From: Stephen Berman <stephen.berman@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
next prev parent reply other threads:[~2012-02-28 20:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-27 22:04 bug#10903: 24.0.93; redisplay glitch with before-string and display overlays Stephen Berman
2012-02-28 20:40 ` Eli Zaretskii [this message]
2012-02-28 22:25 ` Stephen Berman
2012-02-29 17:52 ` Eli Zaretskii
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=831upeelou.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=10903@debbugs.gnu.org \
--cc=stephen.berman@gmx.net \
/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).