Subject: Re: bug#76934: 31.0.50; rectangle-mark-mode resets fringe-mode settings

From: Stephen Berman <[email-masked]>
Date: Tue, 11 Mar 2025 17:50:50 +0100

On Tue, 11 Mar 2025 14:34:09 +0000 the_wurfkreuz <[email-masked]> wrote:

> Sorry for the bad report.
> Initially, there is the fringe area (shown in the attached file called
> "first-screenshot"). I can interactively execute the fringe-mode command it
> choose the 'minimal' option. It makes the fringe area to visually disappear
> and emacs adjusts the space between the fringe of the window and line numbers
> accordingly (shown in the second-screenshot). Then i use the
> rectangle-mark-mode command and doing so returns the space that was previously
> taken by the fringe area back (shown in the third-screenshot). Yes, the added
> space doesn't use any highlighting, so you can't verify it by looking at the
> highlighting for the fringe-area, my description was confusing on that part.

I can reproduce the problem in the emacs-29, -30 and master branches on
GNU/Linux (I cannot currently test earlier builds).  It appears to be an
interaction between display-line-numbers-mode and rectangle-mark-mode:

0. emacs -Q
1. M-: (car (window-absolute-pixel-position))
   => 88
2. M-x display-line-numbers-mode
3. M-: (car (window-absolute-pixel-position))
   => 120
4. C-x SPC
5. M-: (car (window-absolute-pixel-position))
   => 130
6. C-g
7. M-: (car (window-absolute-pixel-position))
   => 128

After disabling and then re-enabling display-line-numbers-mode the extra
space appears without enabling rectangle-mark-mode:

8. M-x display-line-numbers-mode
9. M-: (car (window-absolute-pixel-position))
   => 88
10. M-x display-line-numbers-mode
11. M-: (car (window-absolute-pixel-position))
   => 128

Splitting the window vertically removes the extra space (but splitting
it horizontally (C-x 3) does not):

12. C-x 2
13. M-: (car (window-absolute-pixel-position))
   => 120

On restoring the single window the extra space reappears:

14. C-x 1
15. M-: (car (window-absolute-pixel-position))
   => 128

Steve Berman