unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Arsen Arsenović" <arsen@aarsen.me>
Cc: 75168@debbugs.gnu.org
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	[thread overview]
Message-ID: <86o70vq9k2.fsf@gnu.org> (raw)
In-Reply-To: <86o70vv79r.fsf@aarsen.me> (bug-gnu-emacs@gnu.org)

> 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	other threads:[~2024-12-29  6:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-28 21:15 bug#75168: 31.0.50; text-scale confuses ruler-mode when display-line-number-mode is active Arsen Arsenović via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-29  6:37 ` Eli Zaretskii [this message]
2024-12-29 12:06   ` Arsen Arsenović via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86o70vq9k2.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=75168@debbugs.gnu.org \
    --cc=arsen@aarsen.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).