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

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

bug#27427: 26.0.50; Native line numbers lead to display error in company


From: Eli Zaretskii
Subject: bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup
Date: Tue, 27 Jun 2017 17:48:13 +0300

> Date: Tue, 27 Jun 2017 09:06:06 +0200
> From: martin rudalics <rudalics@gmx.at>
> CC: dgutov@yandex.ru, alexanderm@web.de, 27427@debbugs.gnu.org
> 
>  > If we let Emacs escape into the main loop, we cannot control when
>  > redisplay kicks in and what effect does it have.  For example, some
>  > timer could display a message that could be longer than a single
>  > screen line, so Emacs will resize the echo area and as result
>  > redisplay the windows above the mode line.  Since the text of the
>  > popup comes from a source about which the display engine knows
>  > absolutely nothing, redisplay will do its job assuming that the screen
>  > shows the contents before we overwrote it, and thus will completely
>  > mess up the display.  Even if the code which displayed the popup gets
>  > control right away (which isn't guaranteed in general, since
>  > company-mode wants to be able to run arbitrary Lisp given user
>  > interaction with the popup), the user will see a momentary flash of
>  > messed-up display.
> 
> I assume that the buffer position of the popup would have been specified
> by company-mode before.  Hence, if on a terminal the character at that
> position would get displayed, the display engine would try to display
> the overlay for the popup there instead.  On the right and below of that
> position if it fits, "anywhere there" otherwise, possibly truncating it
> to keep the echo area free as you did for menus.  And that overlay would
> stick at that buffer position until company-mode removes it.
> 
> So resizing the echo area would, in the worst case, not display the
> popup because its buffer position would be temporarily off screen.  But
> I can't imagine any mess up here.

I think we are miscommunicating.  I was describing what would happen
if we try to use the same method as used for TTY menus.  There are no
overlays there, the glyphs are concocted out of thin air by C code and
put into the glyph matrices, overwriting what the display engine
thinks should be there.

By contrast, you are talking about using an overlay, which is what
company-mode is using already, and which is the source of the trouble
Dmitry would like to avoid.  The basic problem here is that the
company-mode popup is multiline, and Emacs cannot display rectangular
regions, only lines.  So company-mode inserts newlines into the
overlay string, and the result is that the popup covers parts of the
display which company-mode doesn't want to conceal.  So it needs to
copy those parts to the overlay string, to make the impression they
weren't covered by the overlay.  It also needs to make all kinds of
layout calculations and decisions.  All that in order to make an
impression of displaying a rectangular region at certain screen
coordinates, something that we ideally should have provided in the
display engine.

>  > I don't see how the echo area can fit the job, since the space there
>  > is very small and there's no way to let the user select an alternative
>  > using menu-like interaction.
> 
> The echo area can be resized and can emulate any menu-like interaction.

Yes, but not conveniently.  And if we are going to emulate, why use
the echo area at all? why not pop up a buffer, like Help mode does?





reply via email to

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