GNU bug report logs - #41537
26.3; window-body-width wrong return value when display-line-numbers-mode is on

Previous Next

Package: emacs;

Reported by: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>

Date: Tue, 26 May 2020 13:02:01 UTC

Severity: normal

Tags: notabug

Found in version 26.3

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

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
Cc: 41537 <at> debbugs.gnu.org
Subject: Re: bug#41537: 26.3;
 window-body-width wrong return value when display-line-numbers-mode
 is on
Date: Tue, 26 May 2020 18:25:33 +0300
tags 41537 notabug
thanks

> From: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
> Date: Tue, 26 May 2020 13:50:38 +0300
> 
> `window-body-width` and `window-width` return wrong numbers when
> `display-line-numbers-mode` is on.
> 
> For example:
> ```emacs-lisp
> (message (format "Width without line numbers: %d" (window-body-width)))
> (display-line-numbers-mode 1)
> (message (format "Width with line numbers: %d" (window-body-width)))
> ```
> 
> return these lines:
> ```
> Width without line numbers: 209
> Width with line numbers: 209
> ```
> 
> This is obviously wrong since line numbers take some window space.

This is not wrong, since these functions measure the body without the
line numbers.  This is not a bug, but the intended behavior.

> This breaks some packages that rely on `window-body-width` and
> `window-width` to align strings. 

Those packages should adapt to display-line-numbers-mode by taking
into account the value returned by line-number-display-width.




This bug report was last modified 4 years and 278 days ago.

Previous Next


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