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#18285: 24.3.92; A combination of `display' on text and `invisible' and `before/after-string' leads to the before/after string being displayed twice Date: Thu, 21 Aug 2014 17:57:52 +0300 Message-ID: <83ppftc2kv.fsf@gnu.org> References: <86d2bypwx1.fsf@yandex.ru> <83k365defw.fsf@gnu.org> <53F5FD0B.1070800@yandex.ru> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1408633171 26962 80.91.229.3 (21 Aug 2014 14:59:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 21 Aug 2014 14:59:31 +0000 (UTC) Cc: 18285@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 21 16:59:24 2014 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 1XKTpd-0001kD-Kd for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Aug 2014 16:59:17 +0200 Original-Received: from localhost ([::1]:32824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKTpd-0007Gm-0V for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Aug 2014 10:59:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49458) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKTpU-0007D9-Sd for bug-gnu-emacs@gnu.org; Thu, 21 Aug 2014 10:59:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKTpO-0002EO-V7 for bug-gnu-emacs@gnu.org; Thu, 21 Aug 2014 10:59:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42106) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKTpO-0002EJ-RX for bug-gnu-emacs@gnu.org; Thu, 21 Aug 2014 10:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XKTpO-0004dL-ES for bug-gnu-emacs@gnu.org; Thu, 21 Aug 2014 10:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Aug 2014 14:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18285 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18285-submit@debbugs.gnu.org id=B18285.140863308317744 (code B ref 18285); Thu, 21 Aug 2014 14:59:02 +0000 Original-Received: (at 18285) by debbugs.gnu.org; 21 Aug 2014 14:58:03 +0000 Original-Received: from localhost ([127.0.0.1]:49049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XKToQ-0004c8-MS for submit@debbugs.gnu.org; Thu, 21 Aug 2014 10:58:03 -0400 Original-Received: from mtaout28.012.net.il ([80.179.55.184]:36815) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XKToO-0004bc-6g for 18285@debbugs.gnu.org; Thu, 21 Aug 2014 10:58:01 -0400 Original-Received: from conversion-daemon.mtaout28.012.net.il by mtaout28.012.net.il (HyperSendmail v2007.08) id <0NAN00700W6DKH00@mtaout28.012.net.il> for 18285@debbugs.gnu.org; Thu, 21 Aug 2014 17:57:02 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout28.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NAN000MRW72QH60@mtaout28.012.net.il>; Thu, 21 Aug 2014 17:57:02 +0300 (IDT) In-reply-to: <53F5FD0B.1070800@yandex.ru> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:92568 Archived-At: > Date: Thu, 21 Aug 2014 18:07:07 +0400 > From: Dmitry Gutov > CC: 18285@debbugs.gnu.org > > On 08/18/2014 07:07 PM, Eli Zaretskii wrote: > > > Believe it or not, but this is how the code was written 14 years ago, > > although perhaps this particular consequence wasn't intended. But it > > follows logically from how the display engine works. > > I can believe it all right. I guess the question is, could there be a > modification of the current logic that would preserve most of the > current behavior, except for the weird situations like this one. Not easily. This is one of the most complicated spots in the display engine, with "many similar passages all alike". Each display feature (faces, display properties, invisible, overlays, etc.) is handled by its own handler, which knows nothing about the other handlers. On top of that, you could have a display property on an overlay string, so the potential combinations are countless. > > The fundamental issue here is that the 'invisible' property makes all > > the character positions between the start and the end of the overlay > > indistinguishable. Therefore, the display engine considers the > > 'before-string' and 'after-string' of an overlay that spans invisible > > text to be applicable to both the start and the end of the overlay, > > something it wouldn't do if the 'invisible' property were not present. > > Hmm. Maybe the fix could be to make the `invisible' property disable > `display': as long as former is present, the latter won't work. That would undoubtedly cause complaints from heavy users of those, like Org, magit, etc. The current code does it the other way around: the invisible property is almost ignored when there's a display property on the same text. "Almost" because, as I explained, the mere fact of the presence of invisible text affects how before-string and after-string are handled. > After all, that was the intention behind the code I encountered this bug > in. And with the current logic, like you say, if `display' is set, > `invisible' is redundant. Yes, but not the other way around. > > http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00674.html > > > > It was inconclusive. > > Thanks. That looks very much like a bug as well, though maybe again, too > expensive to fix. FWIW, for that issue, if myov2 has higher priority > than myov1 (if only by virtue of being inside and shorter), I'd display > just "STRING2" ("STRING1" would not be visible at all). But that's just > going by logic; maybe there's a use case that would break. I'm quite sure there's some use case somewhere that will break.