GNU bug report logs - #42254
27.0.91; display-line-numbers-mode incoherent shifting behaviour

Previous Next

Package: emacs;

Reported by: Fernando Peña <ferpb1999 <at> gmail.com>

Date: Tue, 7 Jul 2020 23:12:02 UTC

Severity: normal

Tags: notabug

Found in version 27.0.91

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 42254 in the body.
You can then email your comments to 42254 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#42254; Package emacs. (Tue, 07 Jul 2020 23:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Fernando Peña <ferpb1999 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 07 Jul 2020 23:12:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Fernando Peña <ferpb1999 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.91; display-line-numbers-mode incoherent shifting behaviour
Date: Tue, 7 Jul 2020 23:55:12 +0200
[Message part 1 (text/plain, inline)]
Hello,

I've noticed that when displaying line numbers with
display-line-numbers-mode, the buffer shifts to the right to make space
for one more digit before the line whose number has one more digit
appears on the screen.

The line number where it shifts seems to depend on the width of the
frame, but for example with 3 digits, the buffer shifts around line 90,
before the 100th is on the screen. This happens even if the file has
less than 100 lines, leaving and excessive space on the left side of the
line numbers.

I'd expect that the buffer only shifted to the left when it was strictly
necessary. In this case, when the number 100 was shown on screen.

I hope it can be solved. I find it really annoying, especially when the
file doesn't have line numbers with that extra digit.

Greetings,

Fernando


In GNU Emacs 27.0.91 (build 1, x86_64-apple-darwin19.5.0, NS appkit-1894.50
Version 10.15.5 (Build 19F101))
of 2020-06-17 built on iMac-de-User.local
Repository revision: a71d1787f128c642f8a1fb297ef5043e20218646
Repository branch: emacs-27
Windowing system distributor 'Apple', version 10.3.1894
System Description:  Mac OS X 10.15.5

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Quit
Display-Line-Numbers mode enabled in current buffer
Making completion list...
101 (#o145, #x65, ?e)
Making completion list...

Configured using:
'configure --enable-locallisppath=/usr/local/share/emacs/site-lisp
--infodir=/usr/local/Cellar/emacs-head <at> 27/HEAD-a71d178_1/share/info/emacs
--prefix=/usr/local/Cellar/emacs-head <at> 27/HEAD-a71d178_1 --without-x
--without-dbus --without-imagemagick --with-modules --with-gnutls
--with-rsvg --with-xml2 --with-ns --disable-ns-self-contained
--with-harfbuzz'

Configured features:
RSVG GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS
MODULES THREADS JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LANG: es_ES.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  display-line-numbers-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
display-line-numbers tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads kqueue cocoa ns lcms2 multi-tty make-network-process
emacs)

Memory information:
((conses 16 45832 11204)
(symbols 48 5949 1)
(strings 32 15408 1983)
(string-bytes 1 518053)
(vectors 16 10250)
(vector-slots 8 127529 16008)
(floats 8 20 28)
(intervals 56 240 0)
(buffers 1000 13))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42254; Package emacs. (Wed, 08 Jul 2020 14:11:01 GMT) Full text and rfc822 format available.

Message #8 received at 42254 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Fernando Peña <ferpb1999 <at> gmail.com>
Cc: 42254 <at> debbugs.gnu.org
Subject: Re: bug#42254: 27.0.91;
 display-line-numbers-mode incoherent shifting behaviour
Date: Wed, 08 Jul 2020 17:10:10 +0300
tags 42254 notabug
thanks

> From: Fernando Peña <ferpb1999 <at> gmail.com>
> Date: Tue, 7 Jul 2020 23:55:12 +0200
> 
> I've noticed that when displaying line numbers with
> display-line-numbers-mode, the buffer shifts to the right to make space
> for one more digit before the line whose number has one more digit
> appears on the screen.
> 
> The line number where it shifts seems to depend on the width of the
> frame, but for example with 3 digits, the buffer shifts around line 90,
> before the 100th is on the screen. This happens even if the file has
> less than 100 lines, leaving and excessive space on the left side of the
> line numbers.
> 
> I'd expect that the buffer only shifted to the left when it was strictly
> necessary. In this case, when the number 100 was shown on screen.
> 
> I hope it can be solved. I find it really annoying, especially when the
> file doesn't have line numbers with that extra digit.

This is not a bug, but the intended behavior.  The design of the
line-numbers display is optimized for speed, so line numbers are
produced on the fly, without knowing exactly how many lines will fit
in the window (knowing the latter would need to produce all the lines
in a window on each redisplay, which is significantly slower).
Because the display engine doesn't know how many lines will fit, it
guesses based on the smallest font used by the frame, so it usually
overestimates, and switches to the wider field slightly before that is
actually needed.

I think it is a very small price to pay for a feature that imposes
almost no slowdown on the display operations.

If this side effect annoys you too much, I suggest to customize the
variable display-line-numbers-width-start to a non-nil value, then the
width of the line-number fields will always be exactly how much is
needed for the buffer.




Added tag(s) notabug. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 08 Jul 2020 14:11:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42254; Package emacs. (Wed, 08 Jul 2020 14:51:01 GMT) Full text and rfc822 format available.

Message #13 received at 42254 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Fernando Peña <ferpb1999 <at> gmail.com>
Cc: 42254 <at> debbugs.gnu.org
Subject: Re: bug#42254: 27.0.91;
 display-line-numbers-mode incoherent shifting behaviour
Date: Wed, 08 Jul 2020 17:50:20 +0300
[Please use Reply All to reply, so that the bug tracker gets CC'ed.]

> From: Fernando Peña <ferpb1999 <at> gmail.com>
> Date: Wed, 8 Jul 2020 16:38:57 +0200
> 
> Okay, thanks very much for your time. Yeah, I tweaked all the variables I saw in the mode, including the one
> you mentioned. The problem is that when the buffer has 80-99 lines for example, it still shifts to the right
> when displaying the bottom.

If the variable I mentioned is non-nil, there shouldn't be any shift
at all.  Can you show an example of such a file?  Maybe there's some
bug after all.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42254; Package emacs. (Wed, 08 Jul 2020 15:19:02 GMT) Full text and rfc822 format available.

Message #16 received at 42254 <at> debbugs.gnu.org (full text, mbox):

From: Fernando Peña <ferpb1999 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 42254 <at> debbugs.gnu.org
Subject: Re: bug#42254: 27.0.91;
 display-line-numbers-mode incoherent shifting behaviour
Date: Wed, 8 Jul 2020 17:02:40 +0200
[Message part 1 (text/plain, inline)]
Sorry for the Reply All, it's my first time mailing over here.

I tested it on different computers and it always happens.

These are the step to reproduce it:

   1. Open emacs with emacs -q
   2. Open an empty buffer
   3. M-x display-line-numbers-mode
   4. Insert 95 lines (C-u 95 RET)

You should see that there's an extra space on the left of the line numbers,
and
when you scroll up until line 90 or 85 (I think it depends on the window
size)
it disappears. If you scroll down again to the bottom, the buffer is again
shifted to the right.

El mié., 8 jul. 2020 a las 16:50, Eli Zaretskii (<eliz <at> gnu.org>) escribió:

> [Please use Reply All to reply, so that the bug tracker gets CC'ed.]
>
> > From: Fernando Peña <ferpb1999 <at> gmail.com>
> > Date: Wed, 8 Jul 2020 16:38:57 +0200
> >
> > Okay, thanks very much for your time. Yeah, I tweaked all the variables
> I saw in the mode, including the one
> > you mentioned. The problem is that when the buffer has 80-99 lines for
> example, it still shifts to the right
> > when displaying the bottom.
>
> If the variable I mentioned is non-nil, there shouldn't be any shift
> at all.  Can you show an example of such a file?  Maybe there's some
> bug after all.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42254; Package emacs. (Wed, 08 Jul 2020 15:19:02 GMT) Full text and rfc822 format available.

Message #19 received at 42254 <at> debbugs.gnu.org (full text, mbox):

From: Fernando Peña <ferpb1999 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 42254 <at> debbugs.gnu.org
Subject: Re: bug#42254: 27.0.91;
 display-line-numbers-mode incoherent shifting behaviour
Date: Wed, 8 Jul 2020 17:09:01 +0200
[Message part 1 (text/plain, inline)]
The behaviour is the same whether  display-line-numbers-width-start is set
or
not to non-nil, and if you save the file and reopen it again.

El mié., 8 jul. 2020 a las 17:02, Fernando Peña (<ferpb1999 <at> gmail.com>)
escribió:

> Sorry for the Reply All, it's my first time mailing over here.
>
> I tested it on different computers and it always happens.
>
> These are the step to reproduce it:
>
>    1. Open emacs with emacs -q
>    2. Open an empty buffer
>    3. M-x display-line-numbers-mode
>    4. Insert 95 lines (C-u 95 RET)
>
> You should see that there's an extra space on the left of the line
> numbers, and
> when you scroll up until line 90 or 85 (I think it depends on the window
> size)
> it disappears. If you scroll down again to the bottom, the buffer is again
> shifted to the right.
>
> El mié., 8 jul. 2020 a las 16:50, Eli Zaretskii (<eliz <at> gnu.org>) escribió:
>
>> [Please use Reply All to reply, so that the bug tracker gets CC'ed.]
>>
>> > From: Fernando Peña <ferpb1999 <at> gmail.com>
>> > Date: Wed, 8 Jul 2020 16:38:57 +0200
>> >
>> > Okay, thanks very much for your time. Yeah, I tweaked all the variables
>> I saw in the mode, including the one
>> > you mentioned. The problem is that when the buffer has 80-99 lines for
>> example, it still shifts to the right
>> > when displaying the bottom.
>>
>> If the variable I mentioned is non-nil, there shouldn't be any shift
>> at all.  Can you show an example of such a file?  Maybe there's some
>> bug after all.
>>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42254; Package emacs. (Wed, 08 Jul 2020 16:22:02 GMT) Full text and rfc822 format available.

Message #22 received at 42254 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Fernando Peña <ferpb1999 <at> gmail.com>
Cc: 42254 <at> debbugs.gnu.org
Subject: Re: bug#42254: 27.0.91;
 display-line-numbers-mode incoherent shifting behaviour
Date: Wed, 08 Jul 2020 19:21:44 +0300
> From: Fernando Peña <ferpb1999 <at> gmail.com>
> Date: Wed, 8 Jul 2020 17:02:40 +0200
> Cc: 42254 <at> debbugs.gnu.org
> 
> 1 Open emacs with emacs -q
> 2 Open an empty buffer
> 3 M-x display-line-numbers-mode
> 4 Insert 95 lines (C-u 95 RET)
> 
> You should see that there's an extra space on the left of the line numbers, and
> when you scroll up until line 90 or 85 (I think it depends on the window size)
> it disappears. If you scroll down again to the bottom, the buffer is again
> shifted to the right.

Ah, okay.  If you add lines, then yes, it will eventually shift.
Sorry I didn't get that before.

So: no bug.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42254; Package emacs. (Wed, 08 Jul 2020 18:08:02 GMT) Full text and rfc822 format available.

Message #25 received at 42254 <at> debbugs.gnu.org (full text, mbox):

From: Fernando Peña <ferpb1999 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 42254 <at> debbugs.gnu.org
Subject: Re: bug#42254: 27.0.91;
 display-line-numbers-mode incoherent shifting behaviour
Date: Wed, 8 Jul 2020 19:02:41 +0200
[Message part 1 (text/plain, inline)]
Okay, thanks for replying.

Greetings,
Fernando

El mié., 8 jul. 2020 a las 18:21, Eli Zaretskii (<eliz <at> gnu.org>) escribió:

> > From: Fernando Peña <ferpb1999 <at> gmail.com>
> > Date: Wed, 8 Jul 2020 17:02:40 +0200
> > Cc: 42254 <at> debbugs.gnu.org
> >
> > 1 Open emacs with emacs -q
> > 2 Open an empty buffer
> > 3 M-x display-line-numbers-mode
> > 4 Insert 95 lines (C-u 95 RET)
> >
> > You should see that there's an extra space on the left of the line
> numbers, and
> > when you scroll up until line 90 or 85 (I think it depends on the window
> size)
> > it disappears. If you scroll down again to the bottom, the buffer is
> again
> > shifted to the right.
>
> Ah, okay.  If you add lines, then yes, it will eventually shift.
> Sorry I didn't get that before.
>
> So: no bug.
>
> Thanks.
>
[Message part 2 (text/html, inline)]

Reply sent to Stefan Kangas <stefan <at> marxist.se>:
You have taken responsibility. (Thu, 13 Aug 2020 00:30:07 GMT) Full text and rfc822 format available.

Notification sent to Fernando Peña <ferpb1999 <at> gmail.com>:
bug acknowledged by developer. (Thu, 13 Aug 2020 00:30:07 GMT) Full text and rfc822 format available.

Message #30 received at 42254-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Fernando Peña <ferpb1999 <at> gmail.com>,
 42254-done <at> debbugs.gnu.org
Subject: Re: bug#42254: 27.0.91;
 display-line-numbers-mode incoherent shifting behaviour
Date: Wed, 12 Aug 2020 17:29:06 -0700
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Fernando Peña <ferpb1999 <at> gmail.com>
>> Date: Wed, 8 Jul 2020 17:02:40 +0200
>> Cc: 42254 <at> debbugs.gnu.org
>>
>> 1 Open emacs with emacs -q
>> 2 Open an empty buffer
>> 3 M-x display-line-numbers-mode
>> 4 Insert 95 lines (C-u 95 RET)
>>
>> You should see that there's an extra space on the left of the line numbers, and
>> when you scroll up until line 90 or 85 (I think it depends on the window size)
>> it disappears. If you scroll down again to the bottom, the buffer is again
>> shifted to the right.
>
> Ah, okay.  If you add lines, then yes, it will eventually shift.
> Sorry I didn't get that before.
>
> So: no bug.

I'm therefore closing this bug report.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 10 Sep 2020 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 200 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.