GNU bug report logs -
#75168
31.0.50; text-scale confuses ruler-mode when display-line-number-mode is active
Previous Next
Reported by: Arsen Arsenović <arsen <at> aarsen.me>
Date: Sat, 28 Dec 2024 21:16:01 UTC
Severity: normal
Found in version 31.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> From: Arsen Arsenović <arsen <at> aarsen.me>
> Cc: 75168 <at> debbugs.gnu.org
> Date: Sat, 11 Jan 2025 14:16:24 +0100
>
> > This is almost perfect. The (- ... 1) in the :width pixel spec is
> > obviously a hack (and breaks this patch in emacs -nw). I have no idea
> > why an extra pixel is inserted in GUI mode. If you apply the above but
> > remove (- ... 1), you'll see the following: [...]
>
> I've refined the patch:
>
> diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el
> index 003dcae560f..64568e06cc9 100644
> --- a/lisp/ruler-mode.el
> +++ b/lisp/ruler-mode.el
> @@ -632,12 +632,7 @@ ruler-mode-ruler
> (let* ((w (ruler-mode-text-scaled-window-width))
> (m (window-margins))
> (f (window-fringes))
> - (i (if display-line-numbers
> - ;; 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))
> - 0))
> + (i 0)
> (j (ruler-mode-text-scaled-window-hscroll))
> ;; Setup the scrollbar, fringes, and margins areas.
> (lf (ruler-mode-space
> @@ -745,6 +740,12 @@ ruler-mode-ruler
> (dolist (p (nreverse props))
> (add-text-properties (nth 0 p) (nth 1 p) (nthcdr 2 p) ruler-str))
>
> + ;; Attach an alignment indent.
> + (if display-line-numbers
> + (setq ruler-str
> + (concat (ruler-mode-space `(,(line-number-display-width t)))
> + ruler-str)))
> +
> ;; Return the ruler propertized string. Using list here,
> ;; instead of concat visually separate the different areas.
> (if (nth 2 (window-fringes))
>
> This works perfectly on PGTK (and with -nw) - that extra pixel I
> mentioned seems to be an artifact, or perhaps a bug, of the Lucid
> toolkit.
>
> What do you think of the above?
Seems to work well, so could you please submit a full patch with the
commit log message, so we could then install this?
Thanks.
This bug report was last modified 174 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.