[Top][All Lists]

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

Re: Native display of line numbers

From: Yuri Khan
Subject: Re: Native display of line numbers
Date: Sun, 18 Jun 2017 23:54:38 +0700

On Sun, Jun 18, 2017 at 9:54 PM, Eli Zaretskii <address@hidden> wrote:

>> The relative ordering of the margin and fringe can be customized with
>> ‘fringes-outside-margins’ but line numbers are always inside both of
>> those. That means a line number area with a non-default background
>> color will visually divide the display. Also, the line wrapping
>> indicator in the fringe is visually separated from the wrapped line.
>> IMO, it should be possible to put the fringe, and maybe the margin,
>> inside line numbers.
> That would AFAIU require a change in basic design of the screen
> layout: it currently assumes only 3 areas, the 2 margins and the text
> area.
> But I'm not sure I understand the motivation: is it due to the
> background issues with the margins?  If so, fixing that might be much
> easier.

The base motivation is to have an intuitive ordering of out-of-buffer
adornments. Out of the box in Emacs, there are:

* line numbers
* line wrap indicators
* horizontal scrolling indicators
* debugging overlay arrows

Some IDEs also display in their gutters:

* change bars indicating modifications since the last commit (in
Emacs, see Git-Gutter)
* in-buffer bookmark indicators (functionality of bm.el)
* folding indicators and controls (functionality of outline-minor-mode)
* static analysis warnings (flycheck)

Some of these attract to the buffer text more strongly than others.

Let’s take scrolling indicators, because it’s easiest to explain the logic.

Suppose a long line:

    Lorem ipsum dolor sit amet, consectetur wgah’nagl fhtagn.

We put it in a narrow window:

    Lorem ipsum dolor sit amet, consectetur »

We can scroll it horizontally:

    « sit amet, consectetur wgah’nagl fhtagn.

So far, in all cases, a scrolling indicator implies some text is
elided at this point.

Now we enable line numbers. As is:

    « 42  amet, consectetur wgah’nagl fhtagn.

If the elided text were inserted at the position of the indicator, the
line number would end up in the middle of the line. Compare:

    42 «t amet, consectetur wgah’nagl fhtagn.

Similarly, a pair of wrapping indicators serves as a “portal” which a
long line enters and another “portal” out of which the continuation
emerges. They want to be immediately adjacent to the line.

    42 Lorem ipsum dolor sit amet, consectetu}
      }r wgah’nagl fhtagn.

If the margin background issue were fixed but line numbers remained
closely tied to the buffer, I would probably continue using the now
deprecated linum-mode, because this configuration gives me the
intuitive ordering.

reply via email to

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