bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18285: 24.3.92; A combination of `display' on text and `invisible' a


From: Eli Zaretskii
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

> Date: Thu, 21 Aug 2014 18:07:07 +0400
> From: Dmitry Gutov <dgutov@yandex.ru>
> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]