emacs-devel
[Top][All Lists]
Advanced

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

Re: Line height issues with display-line-number-mode


From: Eli Zaretskii
Subject: Re: Line height issues with display-line-number-mode
Date: Wed, 08 May 2019 10:01:30 +0300

> Cc: address@hidden
> From: Clément Pit-Claudel <address@hidden>
> Date: Tue, 7 May 2019 17:08:24 -0400
> 
> On 2019-05-07 14:31, Eli Zaretskii wrote:
> > I don't understand what do you want to see instead of a line number if
> > its face should use a higher font.  The Emacs display is a canvas, so
> > the height of a screen line is determined by the highest display
> > element on that screen line.
> 
> I'm not sure what the ideal behavior would be; for this particular case, I 
> think the best would likely be for the number to be displayed one line below, 
> and no number to be displayed on the yellow line.

"This particular case" being what, in technical terms?  A line that
begins with an overlay string?  A line whose entire contents comes
from an overlay string?  Something else?

We display the line number on the yellow line, because the display
engine produces a number after seeing the first newline that comes
from buffer text, since such a newline increases the line count.  In
your case, that newline is after "test" on line 1.  The yellow line
after that doesn't come from buffer text, so it doesn't increment the
line count, which is why the next line number, "3", is produced only
on the last "test" line.  Producing the line number on the second
"test" line would be trickier, because we must then somehow detect the
_last_ line of a run of screen lines whose line number is the same.
This defeats the simple logic of the current line-number display, in
that it would require us to look at the text of the following lines,
something that is tricky at best (because we only know what is on the
following line _after_ we perform layout, and layout is performed in
the order of buffer positions, top to bottom).

To keep the logic simple (and thus the implementation fast and the
results predictable), we'd need some unequivocal indication that a
line number shouldn't be produced.  The question is: what would be
that indication?  Thus my questions above.

Also note that not producing a line number is not exactly what you
want: you want to see a blank line-number field of the height that is
not larger than the largest display element on the screen line.  See
my response to Stefan why this is somewhat tricky as well.

And finally, the same question I asked Stefan: why are you using this
trick instead of producing an underline with face properties?  If the
problem is that you want to control the thickness of the underline,
providing such a feature is much easier than tweaking line-number
display for these cases.



reply via email to

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