GNU bug report logs - #76734
31.0.50; The line numbers take more space than they need

Previous Next

Package: emacs;

Reported by: the_wurfkreuz <the_wurfkreuz <at> proton.me>

Date: Tue, 4 Mar 2025 06:32:02 UTC

Severity: normal

Found in version 31.0.50

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: the_wurfkreuz <the_wurfkreuz <at> proton.me>
Cc: 76734 <at> debbugs.gnu.org
Subject: bug#76734: 31.0.50; The line numbers take more space than they need
Date: Tue, 04 Mar 2025 16:55:13 +0200
tags 76734 notabug
thanks

> Date: Tue, 04 Mar 2025 06:31:00 +0000
> From:  the_wurfkreuz via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> When using the line-numbers mode, the line numbers start to take an
> additional space from a buffer way before the line count reaches 3
> digit numbers.
> 
> Steps to reproduce:
> 
> 1. Evaluate:
> 
> (global-display-line-numbers-mode 1)
> (setq display-line-numbers 'visual
>       display-line-numbers-type 'relative)
> 
> (fringe-mode '(1 . 1))
> 
> 2. Then create new lines in the same buffer using the newline
>    command. In my case i get an additional space on a 38th line already.

This is by design.  Emacs cannot know how many lines will actually be
shown in the window before it actually shows them all.  By contrast,
it needs to decide how many columns to allocate for line numbers
before it displays even a single line, to avoid the annoying
horizontal movement of text as much as possible.  So it sometimes errs
on the safe side (recall that some lines could be smaller than others
due to different fonts), to avoid the need to display the window
twice, which would significantly punish performance in this mode.

Why is that a problem?




This bug report was last modified 79 days ago.

Previous Next


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