Subject: 27.0.91; display-line-numbers-mode incoherent shifting behaviour
From: Fernando Peña <[email-masked]>
To: [email-masked]
Date: Tue, 7 Jul 2020 23:55:12 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

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@27/HEAD-a71d178_1/share/info/emacs
--prefix=/usr/local/Cellar/emacs-head@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))