From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#10903: 24.0.93; redisplay glitch with before-string and display overlays Date: Tue, 28 Feb 2012 22:40:17 +0200 Message-ID: <831upeelou.fsf@gnu.org> References: <87pqd0hr1o.fsf@escher.home> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1330466624 23409 80.91.229.3 (28 Feb 2012 22:03:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 28 Feb 2012 22:03:44 +0000 (UTC) Cc: 10903@debbugs.gnu.org To: Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 28 23:03:43 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S2V93-0007zU-Se for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Feb 2012 23:03:42 +0100 Original-Received: from localhost ([::1]:48046 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2V93-0006z5-7U for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Feb 2012 17:03:41 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:40836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2V8h-0006xQ-HI for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2012 17:03:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S2V8f-0008NR-II for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2012 17:03:19 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47875) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2V8f-0008NE-FG for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2012 17:03:17 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1S2V8P-0000c6-NH for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2012 17:03:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Feb 2012 22:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10903 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10903-submit@debbugs.gnu.org id=B10903.13304665732344 (code B ref 10903); Tue, 28 Feb 2012 22:03:01 +0000 Original-Received: (at 10903) by debbugs.gnu.org; 28 Feb 2012 22:02:53 +0000 Original-Received: from localhost ([127.0.0.1]:54707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2V8G-0000bb-O0 for submit@debbugs.gnu.org; Tue, 28 Feb 2012 17:02:53 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:60013) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2V84-0000b7-AI for 10903@debbugs.gnu.org; Tue, 28 Feb 2012 17:02:41 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0M0400K00ENDDR00@a-mtaout22.012.net.il> for 10903@debbugs.gnu.org; Tue, 28 Feb 2012 22:38:10 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.124.119.92]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M0400IL5ENL8AW1@a-mtaout22.012.net.il>; Tue, 28 Feb 2012 22:38:10 +0200 (IST) In-reply-to: <87pqd0hr1o.fsf@escher.home> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:57367 Archived-At: > From: Stephen Berman > 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