GNU bug report logs -
#78953
31.0.50; tab-bar-format-align-right alignment breaks if field widths change
Previous Next
To reply to this bug, email your comments to 78953 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
juri <at> linkov.net, bug-gnu-emacs <at> gnu.org
:
bug#78953
; Package
emacs
.
(Fri, 04 Jul 2025 06:41:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Daniel Mendler <mail <at> daniel-mendler.de>
:
New bug report received and forwarded. Copy sent to
juri <at> linkov.net, bug-gnu-emacs <at> gnu.org
.
(Fri, 04 Jul 2025 06:41:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
When fields in `tab-bar-format' after `tab-bar-format-align-right'
change their width between two calls, then the alignment breaks - the
right aligned tab field jumps around. Example configuration which uses a
`global-mode-string' with a random width:
(setq tab-bar-format
'( tab-bar-format-tabs
tab-bar-format-align-right
tab-bar-format-global))
(setq global-mode-string
'("|" (:eval (make-string (random 10) ?#)) "|"))
(run-at-time 1 1 #'force-mode-line-update t)
A more realistic configuration with a timer (and a variable pitch face)
also shows the problem. A possible solution could be to handle
`tab-bar-format-align-right' in `tab-bar-format-list', such that the
functions in the `tab-bar-format' list after
`tab-bar-format-align-right' are not called twice, such that the
computed field width matches the displayed field.
In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.49, cairo version 1.18.4) of 2025-06-20
Windowing system distributor 'The X.Org Foundation', version 11.0.12101016
System Description: Debian GNU/Linux 13 (trixie)
Configured using:
'configure --prefix=$HOME/.local/share/emacs
--without-compress-install --with-tree-sitter --with-native-compilation
--with-dbus --without-selinux --without-threads --disable-gc-mark-trace
--without-gsettings --without-gpm --with-cairo --with-cairo-xcb
--with-xinput2 --with-x-toolkit=gtk3 --without-toolkit-scroll-bars'
Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG LIBOTF LIBSYSTEMD
LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SOUND SQLITE3 TIFF TREE_SITTER WEBP X11 XDBE XIM XINERAMA XINPUT2 XPM
XRANDR GTK3 ZLIB
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78953
; Package
emacs
.
(Fri, 04 Jul 2025 06:54:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 78953 <at> debbugs.gnu.org (full text, mbox):
> When fields in `tab-bar-format' after `tab-bar-format-align-right'
> change their width between two calls, then the alignment breaks - the
> right aligned tab field jumps around. Example configuration which uses a
> `global-mode-string' with a random width:
>
> (setq tab-bar-format
> '( tab-bar-format-tabs
> tab-bar-format-align-right
> tab-bar-format-global))
>
> (setq global-mode-string
> '("|" (:eval (make-string (random 10) ?#)) "|"))
>
> (run-at-time 1 1 #'force-mode-line-update t)
Thanks, I confirm the problem.
> A more realistic configuration with a timer (and a variable pitch face)
> also shows the problem. A possible solution could be to handle
> `tab-bar-format-align-right' in `tab-bar-format-list', such that the
> functions in the `tab-bar-format' list after
> `tab-bar-format-align-right' are not called twice, such that the
> computed field width matches the displayed field.
So need to update :align-to in tab-bar-format-list.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78953
; Package
emacs
.
(Fri, 04 Jul 2025 07:22:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 78953 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
>> When fields in `tab-bar-format' after `tab-bar-format-align-right'
>> change their width between two calls, then the alignment breaks - the
>> right aligned tab field jumps around. Example configuration which uses a
>> `global-mode-string' with a random width:
>>
>> (setq tab-bar-format
>> '( tab-bar-format-tabs
>> tab-bar-format-align-right
>> tab-bar-format-global))
>>
>> (setq global-mode-string
>> '("|" (:eval (make-string (random 10) ?#)) "|"))
>>
>> (run-at-time 1 1 #'force-mode-line-update t)
>
> Thanks, I confirm the problem.
Thanks for checking.
>> A more realistic configuration with a timer (and a variable pitch face)
>> also shows the problem. A possible solution could be to handle
>> `tab-bar-format-align-right' in `tab-bar-format-list', such that the
>> functions in the `tab-bar-format' list after
>> `tab-bar-format-align-right' are not called twice, such that the
>> computed field width matches the displayed field.
>
> So need to update :align-to in tab-bar-format-list.
Yes, exactly.
Also another problem I've observed is that `string-pixel-width' is slow,
which is a problem with frequent updates/redisplays, for example when
scrolling a lot with `pixel-scroll-precision-mode'.
I suggest to update `:align-to' in `tab-bar-format-list' and also cache
the computed width and the formatted tab bar string. Then the cached
string can be compared with `equal-including-properties` and only if the
string changes, the pixel width needs to be recomputed.
Daniel
This bug report was last modified today.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.