bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#75168: 31.0.50; text-scale confuses ruler-mode when display-line-num


From: Eli Zaretskii
Subject: bug#75168: 31.0.50; text-scale confuses ruler-mode when display-line-number-mode is active
Date: Sun, 29 Dec 2024 08:37:17 +0200

> Date: Sat, 28 Dec 2024 22:15:28 +0100
> From:  Arsen Arsenović via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Reproduction steps:
> 1. emacs -Q
> 2. M-x display-line-numbers-mode RET
> 3. M-x ruler-mode RET
> 4. C-x C-+ C-+ C-+ C-+
> 
> You should notice that the ruler is misaligned.

Ruler mode doesn't work well with text-scale, as the comment there says.

> I've hotfixed this in my running Emacs by applying:
> 
> modified   lisp/ruler-mode.el
> @@ -636,7 +636,7 @@ ruler-mode-ruler
>                  ;; FIXME: ruler-mode relies on I being an integer, so
>                  ;; the column numbers might be slightly off if the
>                  ;; line-number face is customized.
> -                (round (line-number-display-width 'columns))
> +                (+ (round (line-number-display-width)) 2)
>                0))
>           (j (ruler-mode-text-scaled-window-hscroll))
>           ;; Setup the scrollbar, fringes, and margins areas.
> 
> ... and re-evaling the ruler-mode-ruler defun.
> 
> Per the line-number-display-width doc, when it is called with 'columns,
> it returns the number of columns in the frames canonical font size, but
> that's not the font size that is used for the fringes: the fringes seem
> to use the font the buffer is using, at least after text-scale-mode does
> its thing.

I'm not sure I understand what you mean by "fringes seem to use the
font the buffer is using".  When I type "C-x C-+ C-+...", the fringes
stay at their original width.  Do you see something different?

Anyway, the change you suggest is basically going back to what we had
before fixing bug#28855, so I don't think we can make such a change,
at least not literally.  We need something more complex to account for
the use cases described in that bug.

> Interestingly, changing text-scale-remap-header-line appears to have no
> effect, but that variable ought to be accounted for somehow also, I
> think?  Though, if the line-numbers and header line always use the same
> face, then the above should be correct, I think?

If you take a look at ruler-mode.el, you will see that it overrides
header-line-format by its own code.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]