all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: alexanderm@web.de, 27427@debbugs.gnu.org
Subject: bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup
Date: Sat, 24 Jun 2017 02:26:23 +0300	[thread overview]
Message-ID: <513eca6f-998a-a937-76c4-7cf2fb0ff787@yandex.ru> (raw)
In-Reply-To: <83a84zul0d.fsf@gnu.org>

On 6/23/17 12:10 PM, Eli Zaretskii wrote:

> Sorry, I thought that by "related to this" you alluded to the
> zero-column-at-BOL assumption.

I just meant that until now this code coped pretty well with what can be 
found in practice. There are various issues, but none of them were 
zero-column related.

> Not really.  The display engine was always inserting stuff at the
> beginning of a visual line.  Some features that use this include
> line-prefix and wrap-prefix, the left truncation glyphs, and
> overlay-arrow.  It's just that AFAIU company-mode has coded
> workarounds for each one of them, and now there's one more feature to
> deal with.

I don't remember (or see in the code) any workarounds for any of these, 
aside from line-prefix text property. Maybe we're missing certain 
problem situations, of course (examples welcome). Do most of these only 
appear in non-graphical mode?

>> Why not put it outside of the window bounds next to the "actual"
>> margins? That's one option.
> 
> That option requires a thorough redesign of the canvas geometry used
> by the display engine: currently there's no area for it to put glyphs
> except the 3 existing ones -- the two margins and the text area.

In that case, I think we should try harder to make use of the margins.

> As long as only one mode uses the margins, no problems indeed.  Once
> there are two or more, they need to work around one another, and that
> doesn't work very well, sometimes not at all.

Violent agreement, isn't it?

Again, it's a known problem. You're trying to work around it in a way 
that doesn't scale to any potential similar new features, and which 
breaks company-mode popup (and probably some other overlay-wrangling 
code as well, I'm guessing).

I'm saying the users seem willing to wait for a scalable solution, and 
use a margin in the meantime. After all, we have two margins, and two 
fringes as well.

>> But of course, it would be ideal if you could also introduce a facility
>> that would allow sharing of margins (and hopefully also fringes) between
>> different modes.
> 
> Alas, we don't have any consensus for how should this be done.

I can try to outline a possible API. Do we have an existing bug report 
where that discussion would be better placed?

If you have a link to a previous discussion, that would be great as well.

>>> Not sure what you mean by "chromeless" here, but if I understand you
>>> correctly, Martin's work is already on master.
>>
>> I think so, yes.
> 
> I'd urge you to see if company-mode can switch to using these
> facilities, as working against the display engine works only up to a
> point, and doubtless causes many maintenance headaches.

It sounds like a fair amount of work, so it's low on my list. Improving 
ruby-mode and xref seems more important.

>> Yes, but also the lack of ability to disable the line numbering on a
>> line-by-line basis (which could be one solution for this problem).
> 
> If providing such a facility would solve the problem, it should be
> easy to code.  E.g., we could have a display-line-numbers-disable
> property which a Lisp program could put on the first visible character
> of a visual line, and a non-nil value of that property would signal to
> the display engine not to produce the line-number glyphs for that
> visual line.  Would that be okay?

Should be fine, if we find no better choice. As long as that property 
can be set via an overlay.

> (Note that line-number display
> produces glyphs even for lines for which no number should be
> displayed, such as continuation lines and empty screen lines beyond
> EOB, so company-mode would need to decide whether it needs to disable
> those as well.  Which is why I wrote "the first visible character of a
> visual line" above, emphasis on "visual".)

Visual line sounds right.

>> Imagine of the line numbers were displayed using line-prefix (I'm not
>> really suggesting that, but...). Then the popup could pick them up and
>> include in the overlay's `display' property text. The user wouldn't see
>> any difference.
> 
> You can do similar things with line numbers: Lisp code can count lines
> as well as C code, and the fact that the line numbers are being
> displayed is easily detected from Lisp.

I can't get to the actual numbers, though. And isn't counting lines in 
Lisp considered too slow? Or why else would we have this new feature?

> (And you didn't yet consider the possibility of _both_ line numbers
> and line-prefix.  Yes, that should be possible, and I intended that to
> be supported.)

I did, it's in the middle of your quote. ;-)

> Anyway, the mess should be expected in any feature which attempts to
> change the display in significant ways, like company-mode does.
> Experience shows that this only works up to a point.  Which is why The
> Right Way to implement such features is to introduce infrastructure
> (on the C level) which will allow the display engine to do the layout
> job as those features need.  Native display of line numbers is one
> step in that direction, from my POV.  I hope that Martin's work on
> child frames will allow company-mode to go in a similar direction as
> well.

Agreed that it's the right direction (although I wouldn't say no to a 
popup library in the core either ;-). Would it help in non-graphical 
mode, though? Does it support non-maximized frames?

> However, this bug report is about letting the current implementation
> of company-mode live in peace with native display of line numbers.  So
> if you tell me that the above-mentioned property will allow such a
> coexistence, I will code it.

Let's try it, if it's not hard to add. I'll report back as soon as it's 
available.





  reply	other threads:[~2017-06-23 23:26 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-19 16:50 bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup Alexander Miller
2017-06-19 17:08 ` Eli Zaretskii
     [not found]   ` <6b307502-53db-e92d-1050-3cf0132537cb@web.de>
2017-06-19 19:23     ` Eli Zaretskii
2017-06-19 19:53       ` Alexander Miller
2017-06-19 21:03   ` Dmitry Gutov
2017-06-20 15:04     ` Eli Zaretskii
2017-06-21  2:18       ` Dmitry Gutov
2017-06-21  2:40         ` Eli Zaretskii
2017-06-21 13:04           ` Dmitry Gutov
2017-06-21 15:51             ` Alexander Miller
2017-06-21 18:15             ` Eli Zaretskii
2017-06-21 22:41               ` Dmitry Gutov
2017-06-22 14:55                 ` Eli Zaretskii
2017-06-22 23:17                   ` Dmitry Gutov
2017-06-23  9:10                     ` Eli Zaretskii
2017-06-23 23:26                       ` Dmitry Gutov [this message]
2017-06-24  7:47                         ` Eli Zaretskii
2017-06-24 17:28                           ` Eli Zaretskii
2017-06-24 20:43                             ` Dmitry Gutov
2017-06-25 13:51                               ` Dmitry Gutov
2017-06-25 14:32                                 ` Eli Zaretskii
2017-06-25 14:36                                   ` Dmitry Gutov
2017-06-25 14:13                               ` Eli Zaretskii
2017-06-25 14:46                                 ` Dmitry Gutov
2017-06-25 15:05                                   ` Eli Zaretskii
2017-06-25 16:35                                     ` Eli Zaretskii
2017-06-25 17:57                                     ` Eli Zaretskii
2017-06-25 22:56                                       ` Dmitry Gutov
2017-06-26  8:23                                         ` martin rudalics
2017-06-26 15:07                                           ` Eli Zaretskii
2017-06-27  7:06                                             ` martin rudalics
2017-06-27 14:48                                               ` Eli Zaretskii
2017-06-26 15:22                                         ` Eli Zaretskii
2017-06-26 15:28                                           ` Dmitry Gutov
2017-06-26 15:50                                             ` Eli Zaretskii
2017-06-26 17:12                                               ` Dmitry Gutov
2017-06-26 21:30                                           ` Johan Bockgård
2017-06-27 16:47                                             ` Eli Zaretskii
2017-07-13 23:04                                         ` Dmitry Gutov
2017-07-14  6:11                                           ` Eli Zaretskii
2017-07-14  6:24                                             ` Dmitry Gutov
2017-07-14  7:04                                               ` Eli Zaretskii
2017-07-15 17:38                                                 ` Dmitry Gutov
2017-07-15 17:49                                                   ` Eli Zaretskii
2017-06-25 14:31                           ` Dmitry Gutov
2017-06-25 14:54                             ` Eli Zaretskii
2017-06-25 15:25                               ` Dmitry Gutov
2017-06-25 16:12                               ` martin rudalics
2017-06-25 18:21                                 ` Eli Zaretskii
2017-06-25 15:59                             ` martin rudalics
2017-06-25 16:24                               ` Dmitry Gutov
2017-06-25 17:10                                 ` martin rudalics
2017-06-25 18:36                                   ` Eli Zaretskii
2017-06-25 18:51                                     ` Eli Zaretskii
2017-06-26  8:21                                       ` martin rudalics
2017-06-26  8:18                                     ` martin rudalics
2017-06-25 18:24                                 ` Eli Zaretskii
2017-06-26  7:15                                   ` martin rudalics
2017-06-26  8:18                                   ` martin rudalics
2017-06-26 12:07                                     ` Dmitry Gutov
2017-06-26 15:05                                     ` Eli Zaretskii
2017-06-27  7:06                                       ` martin rudalics
2017-06-27 14:48                                         ` Eli Zaretskii
2017-06-27 15:27                                           ` martin rudalics
2017-06-27 16:27                                             ` Eli Zaretskii
2017-06-28  8:45                                               ` martin rudalics
2017-06-28 16:48                                                 ` Eli Zaretskii
2017-06-28 18:35                                                   ` martin rudalics
2017-06-28 18:56                                                     ` Eli Zaretskii
2017-06-29  7:17                                                       ` martin rudalics
2017-06-29 16:29                                                         ` Eli Zaretskii
2017-06-30  8:27                                                           ` martin rudalics
2017-06-30  9:33                                                             ` Eli Zaretskii
2017-07-01 10:31                                                               ` martin rudalics
2017-07-01 11:59                                                                 ` Eli Zaretskii
2017-07-01 13:22                                                                   ` martin rudalics
2017-07-01 13:33                                                                     ` Eli Zaretskii
2017-07-01 15:20                                                                       ` martin rudalics
2017-07-01 15:41                                                                         ` Eli Zaretskii
2017-07-02  7:54                                                                           ` martin rudalics
2017-07-02 14:10                                                                             ` Eli Zaretskii
2017-07-02 14:45                                                                               ` Dmitry Gutov
2017-07-02 15:18                                                                                 ` Eli Zaretskii
2017-07-03  0:22                                                                                   ` Dmitry Gutov
2017-07-03  2:29                                                                                     ` Eli Zaretskii
2017-07-06  7:08                                                                                 ` martin rudalics
2017-07-06 13:06                                                                                   ` Dmitry Gutov
2017-07-07  6:52                                                                                     ` martin rudalics
2017-07-06  7:08                                                                               ` martin rudalics
2017-07-06 15:21                                                                                 ` Eli Zaretskii
2017-07-07  6:52                                                                                   ` martin rudalics
2017-06-29  1:34                                                   ` Dmitry Gutov
2017-06-29 16:20                                                     ` Eli Zaretskii
2017-06-29 17:55                                                       ` Dmitry Gutov
2017-06-25 19:00                               ` Eli Zaretskii
2017-06-26  8:21                                 ` martin rudalics
2017-06-26 15:06                                   ` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=513eca6f-998a-a937-76c4-7cf2fb0ff787@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=27427@debbugs.gnu.org \
    --cc=alexanderm@web.de \
    --cc=eliz@gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.