[Top][All Lists]

[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 17:00:27 +0300

> Cc: address@hidden
> From: Clément Pit-Claudel <address@hidden>
> Date: Wed, 8 May 2019 08:24:53 -0400
> > "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?
> I'm not sure; I think 'a line whose entire contents come from an overlay 
> string' is probably right.

That's harder than "starts with an overlay string", but still doable,
I think.  However, I wonder whether it will cover enough use cases.

> > 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.
> I'm trying to produce a line that stretches the entire width of the window; 
> can this be done with underlines?  Controlling the thickness of the line is 
> not a strict requirement for me.

Using an image comes to mind.  Did you consider that?

Another alternative is an empty line with the underline face.  If you
want it to fit to window dynamically, you can use the :space display
property with :align-to property.

> Additionally, I use think lines not just to draw a colored line, but also for 
> padding around it (so quick-peek in fact displays one think blank line, one 
> thin line with a background, and another thin blank line).  Similarly, in 
> compact-docstrings mode, I use face properties to make certain lines less 
> tall.

What is the purpose of changing the line height in these cases?

> - Hide line numbers (but it means computing a height for the line and then 
> comparing it to the height needed for line numbers)
> - Clip them (like nlinum did; but clipping is easier in the margin than in 
> the buffer area; is that correct?).

On the margin it just happens to work "by sheer luck", because we
simply don't care enough about the text displayed on the margins, and
so don't take it into consideration when computing the line metrics.

The problems with doing the same in the text area I already described
in another message.  They are not insurmountable, but "Someone" should
examine all those corner cases and make sure we behave reasonably with
such a change.

> - Shrink the font?  Could line numbers be set to the same face as the line 
> feed on their line?

Maybe with some effort, but wouldn't having smaller numbers on some
lines look ugly?  It will cause the text to begin more to the left,
although for empty lines this might not matter, if they use the
default background.

> That being said, the trickiest case is the one with overlays, since (IIUC) I 
> can handle the compact-docstrings case by putting a property on the lines to 
> disable line numbers manually.

You'd also need to manually indent the line with some overlay string,
to have it lined up with those that do have line numbers, but other
than that, yes, it should work.

reply via email to

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