GNU bug report logs - #60210
30.0.50; tab-bar height not recalculated when face changes

Previous Next

Package: emacs;

Reported by: Gabriel do Nascimento Ribeiro <gabriel376 <at> hotmail.com>

Date: Mon, 19 Dec 2022 23:10:01 UTC

Severity: normal

Found in version 30.0.50

Done: Gregory Heytings <gregory <at> heytings.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60210 in the body.
You can then email your comments to 60210 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#60210; Package emacs. (Mon, 19 Dec 2022 23:10:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gabriel do Nascimento Ribeiro <gabriel376 <at> hotmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 19 Dec 2022 23:10:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gabriel do Nascimento Ribeiro <gabriel376 <at> hotmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 30.0.50; tab-bar height not recalculated when face changes
Date: Mon, 19 Dec 2022 23:04:25 +0000
Steps:

1) emacs -Q (master "ae91da52335aafaff5405a49c23460082dfb460d")

2) Enable tab-bar:

   (tab-bar-mode +1)

3) Change some face attribute of tab-bar to force increase the tab-bar
height, e.g:

   (set-face-attribute 'tab-bar nil :box 4)
   (set-face-attribute 'tab-bar nil :height 1.2)

Result: the new face is displayed and the tab-bar height is properly
adjusted to reflect the new height.

4) Reset face attributes of tab-bar to force original height, e.g.:

   (set-face-attribute 'tab-bar nil :box nil)
   (set-face-attribute 'tab-bar nil :height 1.0)

Result: the new face is displayed, but the tab-bar height is not
properly adjusted to reflect the new height.

---
Gabriel



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60210; Package emacs. (Sun, 25 Dec 2022 08:52:02 GMT) Full text and rfc822 format available.

Message #8 received at 60210 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Gabriel do Nascimento Ribeiro <gabriel376 <at> hotmail.com>
Cc: 60210 <at> debbugs.gnu.org
Subject: Re: bug#60210: 30.0.50; tab-bar height not recalculated when face
 changes
Date: Sun, 25 Dec 2022 10:35:10 +0200
> 2) Enable tab-bar:
>
>    (tab-bar-mode +1)
>
> 3) Change some face attribute of tab-bar to force increase the tab-bar
> height, e.g:
>
>    (set-face-attribute 'tab-bar nil :box 4)
>    (set-face-attribute 'tab-bar nil :height 1.2)
>
> Result: the new face is displayed and the tab-bar height is properly
> adjusted to reflect the new height.
>
> 4) Reset face attributes of tab-bar to force original height, e.g.:
>
>    (set-face-attribute 'tab-bar nil :box nil)
>    (set-face-attribute 'tab-bar nil :height 1.0)
>
> Result: the new face is displayed, but the tab-bar height is not
> properly adjusted to reflect the new height.

It seems this is related to recent bug reports about fonts
such as bug#52493, bug#58912, bug#59271, bug#59285, etc.
since there is no such problem in Emacs 28.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60210; Package emacs. (Sun, 25 Dec 2022 09:30:02 GMT) Full text and rfc822 format available.

Message #11 received at 60210 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 60210 <at> debbugs.gnu.org, gabriel376 <at> hotmail.com
Subject: Re: bug#60210: 30.0.50;
 tab-bar height not recalculated when face changes
Date: Sun, 25 Dec 2022 11:29:05 +0200
> Cc: 60210 <at> debbugs.gnu.org
> From: Juri Linkov <juri <at> linkov.net>
> Date: Sun, 25 Dec 2022 10:35:10 +0200
> 
> > 2) Enable tab-bar:
> >
> >    (tab-bar-mode +1)
> >
> > 3) Change some face attribute of tab-bar to force increase the tab-bar
> > height, e.g:
> >
> >    (set-face-attribute 'tab-bar nil :box 4)
> >    (set-face-attribute 'tab-bar nil :height 1.2)
> >
> > Result: the new face is displayed and the tab-bar height is properly
> > adjusted to reflect the new height.
> >
> > 4) Reset face attributes of tab-bar to force original height, e.g.:
> >
> >    (set-face-attribute 'tab-bar nil :box nil)
> >    (set-face-attribute 'tab-bar nil :height 1.0)
> >
> > Result: the new face is displayed, but the tab-bar height is not
> > properly adjusted to reflect the new height.
> 
> It seems this is related to recent bug reports about fonts
> such as bug#52493, bug#58912, bug#59271, bug#59285, etc.
> since there is no such problem in Emacs 28.

I doubt the font-related changes are relevant, but bisecting will be
welcome.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60210; Package emacs. (Mon, 26 Dec 2022 00:25:02 GMT) Full text and rfc822 format available.

Message #14 received at 60210 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 60210 <at> debbugs.gnu.org, gabriel376 <at> hotmail.com,
 Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#60210: 30.0.50; tab-bar height not recalculated when face
 changes
Date: Mon, 26 Dec 2022 00:24:11 +0000
[Message part 1 (text/plain, inline)]
>
> I doubt the font-related changes are relevant, but bisecting will be 
> welcome.
>

Indeed, the culprit is 5db4ec20fe.

Patch attached.
[Improve-handling-of-tab-bar-height.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60210; Package emacs. (Mon, 26 Dec 2022 12:24:01 GMT) Full text and rfc822 format available.

Message #17 received at 60210 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 60210 <at> debbugs.gnu.org, gabriel376 <at> hotmail.com, juri <at> linkov.net
Subject: Re: bug#60210: 30.0.50; tab-bar height not recalculated when face
 changes
Date: Mon, 26 Dec 2022 14:23:09 +0200
> Date: Mon, 26 Dec 2022 00:24:11 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: Juri Linkov <juri <at> linkov.net>, 60210 <at> debbugs.gnu.org, 
>     gabriel376 <at> hotmail.com
> 
> > I doubt the font-related changes are relevant, but bisecting will be 
> > welcome.
> >
> 
> Indeed, the culprit is 5db4ec20fe.
> 
> Patch attached.

Thanks, this LGTM.  If you tested this with tab bars of more than a
single line, including when tabs are removed so a single line is once
again long enough, please install on the release branch.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60210; Package emacs. (Mon, 26 Dec 2022 13:37:02 GMT) Full text and rfc822 format available.

Message #20 received at 60210 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 60210 <at> debbugs.gnu.org, gabriel376 <at> hotmail.com, juri <at> linkov.net
Subject: Re: bug#60210: 30.0.50; tab-bar height not recalculated when face
 changes
Date: Mon, 26 Dec 2022 13:36:20 +0000
>>> I doubt the font-related changes are relevant, but bisecting will be 
>>> welcome.
>>
>> Indeed, the culprit is 5db4ec20fe.
>>
>> Patch attached.
>
> Thanks, this LGTM.  If you tested this with tab bars of more than a 
> single line, including when tabs are removed so a single line is once 
> again long enough, please install on the release branch.
>

I did test it, but I don't use tab bars, so I'm not 110% sure.  Juri, 
could you please test the patch?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60210; Package emacs. (Mon, 26 Dec 2022 17:36:02 GMT) Full text and rfc822 format available.

Message #23 received at 60210 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 60210 <at> debbugs.gnu.org, gabriel376 <at> hotmail.com, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#60210: 30.0.50; tab-bar height not recalculated when face
 changes
Date: Mon, 26 Dec 2022 19:29:01 +0200
>>>> I doubt the font-related changes are relevant, but bisecting will be
>>>> welcome.
>>>
>>> Indeed, the culprit is 5db4ec20fe.
>>>
>>> Patch attached.
>>
>> Thanks, this LGTM.  If you tested this with tab bars of more than
>> a single line, including when tabs are removed so a single line is once
>> again long enough, please install on the release branch.
>
> I did test it, but I don't use tab bars, so I'm not 110% sure.  Juri, could
> you please test the patch?

Thanks for the patch.  I tested it in emacs-29 with tab-bar-lines > 1
and see no problems.




Reply sent to Gregory Heytings <gregory <at> heytings.org>:
You have taken responsibility. (Mon, 26 Dec 2022 17:41:02 GMT) Full text and rfc822 format available.

Notification sent to Gabriel do Nascimento Ribeiro <gabriel376 <at> hotmail.com>:
bug acknowledged by developer. (Mon, 26 Dec 2022 17:41:02 GMT) Full text and rfc822 format available.

Message #28 received at 60210-done <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 60210-done <at> debbugs.gnu.org, gabriel376 <at> hotmail.com,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#60210: 30.0.50; tab-bar height not recalculated when face
 changes
Date: Mon, 26 Dec 2022 17:40:52 +0000
>>> Thanks, this LGTM.  If you tested this with tab bars of more than a 
>>> single line, including when tabs are removed so a single line is once 
>>> again long enough, please install on the release branch.
>>
>> I did test it, but I don't use tab bars, so I'm not 110% sure.  Juri, 
>> could you please test the patch?
>
> Thanks for the patch.  I tested it in emacs-29 with tab-bar-lines > 1 
> and see no problems.
>

Thanks!  Pushed (b14bbd108e), and closing.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60210; Package emacs. (Sun, 01 Jan 2023 17:57:02 GMT) Full text and rfc822 format available.

Message #31 received at 60210 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Juri Linkov <juri <at> linkov.net>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 60210 <at> debbugs.gnu.org
Subject: Re: bug#60210: 30.0.50; tab-bar height not recalculated when face
 changes
Date: Sun, 01 Jan 2023 17:56:36 +0000
>
> Thanks!  Pushed (b14bbd108e), and closing.
>

I got (privately) an interesting bug report about this commit.  The bug is 
that, because of this change, the tab-bar is not displayed anymore (or is 
displayed but stays empty) in certain circumstances.  It's a font-related 
bug again, so it might be difficult to reproduce.  On my system,

(set-face-attribute 'default nil :font "JetBrains Mono")
(tab-bar-mode 1)

triggers the bug.

The bug is that, in redisplay_tab_bar, WINDOW_PIXEL_HEIGHT (w) uses the 
height of the default face, which is 39 pixels, whereas new_height, which 
is computed with tab_bar_height, uses the font of the tab-bar face 
(variable-pitch in emacs -Q).  On my system, new_height is (with a single 
*scratch* tab) 36 pixels.  Therefore new_height < WINDOW_PIXEL_HEIGHT (w), 
when in fact according to the logic of the code we should have new_height 
== WINDOW_PIXEL_HEIGHT (w).





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60210; Package emacs. (Sun, 01 Jan 2023 18:23:02 GMT) Full text and rfc822 format available.

Message #34 received at 60210 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 60210 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60210: 30.0.50; tab-bar height not recalculated when face
 changes
Date: Sun, 01 Jan 2023 20:22:56 +0200
> Date: Sun, 01 Jan 2023 17:56:36 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: 60210 <at> debbugs.gnu.org
> 
> The bug is that, in redisplay_tab_bar, WINDOW_PIXEL_HEIGHT (w) uses the 
> height of the default face, which is 39 pixels, whereas new_height, which 
> is computed with tab_bar_height, uses the font of the tab-bar face 
> (variable-pitch in emacs -Q).  On my system, new_height is (with a single 
> *scratch* tab) 36 pixels.  Therefore new_height < WINDOW_PIXEL_HEIGHT (w), 
> when in fact according to the logic of the code we should have new_height 
> == WINDOW_PIXEL_HEIGHT (w).

I'm not sure I understand how the above causes the tab bar not to be
displayed, or become empty.  AFAIU, it just means the frame's
change_tab_bar_height_hook will be called.  What did I miss?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60210; Package emacs. (Sun, 01 Jan 2023 21:51:01 GMT) Full text and rfc822 format available.

Message #37 received at 60210 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 60210 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60210: 30.0.50; tab-bar height not recalculated when face
 changes
Date: Sun, 01 Jan 2023 21:50:56 +0000
>> The bug is that, in redisplay_tab_bar, WINDOW_PIXEL_HEIGHT (w) uses the 
>> height of the default face, which is 39 pixels, whereas new_height, 
>> which is computed with tab_bar_height, uses the font of the tab-bar 
>> face (variable-pitch in emacs -Q).  On my system, new_height is (with a 
>> single *scratch* tab) 36 pixels.  Therefore new_height < 
>> WINDOW_PIXEL_HEIGHT (w), when in fact according to the logic of the 
>> code we should have new_height == WINDOW_PIXEL_HEIGHT (w).
>
> I'm not sure I understand how the above causes the tab bar not to be 
> displayed, or become empty.  AFAIU, it just means the frame's 
> change_tab_bar_height_hook will be called.  What did I miss?
>

I do not fully understand it either yet.  A simpler recipe, which does not 
involve changing fonts:

(set-face-attribute 'tab-bar nil :height 0.5)
(tab-bar-mode 1)

This should display a tiny tab-bar, it displays a white bar instead.

In redisplay_tab_bar, new_height is set to half the height of a canonical 
line (17 and 34 on my system).  Therefore redisplay_tab_bar returns true. 
The next redisplay cycle finds that WINDOW_TOTAL_LINES (w) == 0, and does 
nothing.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60210; Package emacs. (Mon, 02 Jan 2023 03:30:02 GMT) Full text and rfc822 format available.

Message #40 received at 60210 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 60210 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60210: 30.0.50; tab-bar height not recalculated when face
 changes
Date: Mon, 02 Jan 2023 05:29:50 +0200
> Date: Sun, 01 Jan 2023 21:50:56 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: 60210 <at> debbugs.gnu.org, juri <at> linkov.net
> 
> 
> >> The bug is that, in redisplay_tab_bar, WINDOW_PIXEL_HEIGHT (w) uses the 
> >> height of the default face, which is 39 pixels, whereas new_height, 
> >> which is computed with tab_bar_height, uses the font of the tab-bar 
> >> face (variable-pitch in emacs -Q).  On my system, new_height is (with a 
> >> single *scratch* tab) 36 pixels.  Therefore new_height < 
> >> WINDOW_PIXEL_HEIGHT (w), when in fact according to the logic of the 
> >> code we should have new_height == WINDOW_PIXEL_HEIGHT (w).
> >
> > I'm not sure I understand how the above causes the tab bar not to be 
> > displayed, or become empty.  AFAIU, it just means the frame's 
> > change_tab_bar_height_hook will be called.  What did I miss?
> >
> 
> I do not fully understand it either yet.  A simpler recipe, which does not 
> involve changing fonts:
> 
> (set-face-attribute 'tab-bar nil :height 0.5)
> (tab-bar-mode 1)
> 
> This should display a tiny tab-bar, it displays a white bar instead.
> 
> In redisplay_tab_bar, new_height is set to half the height of a canonical 
> line (17 and 34 on my system).  Therefore redisplay_tab_bar returns true. 
> The next redisplay cycle finds that WINDOW_TOTAL_LINES (w) == 0, and does 
> nothing.

Ah, if WINDOW_TOTAL_LINES becomes zero, that will indeed explain the
problem.  We should prevent that from happening as long as the tab bar
is turned on.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60210; Package emacs. (Mon, 02 Jan 2023 15:07:02 GMT) Full text and rfc822 format available.

Message #43 received at 60210 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 60210 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60210: 30.0.50; tab-bar height not recalculated when face
 changes
Date: Mon, 02 Jan 2023 17:05:49 +0200
> Date: Sun, 01 Jan 2023 21:50:56 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: 60210 <at> debbugs.gnu.org, juri <at> linkov.net
> 
> > I'm not sure I understand how the above causes the tab bar not to be 
> > displayed, or become empty.  AFAIU, it just means the frame's 
> > change_tab_bar_height_hook will be called.  What did I miss?
> >
> 
> I do not fully understand it either yet.  A simpler recipe, which does not 
> involve changing fonts:
> 
> (set-face-attribute 'tab-bar nil :height 0.5)
> (tab-bar-mode 1)
> 
> This should display a tiny tab-bar, it displays a white bar instead.
> 
> In redisplay_tab_bar, new_height is set to half the height of a canonical 
> line (17 and 34 on my system).  Therefore redisplay_tab_bar returns true. 
> The next redisplay cycle finds that WINDOW_TOTAL_LINES (w) == 0, and does 
> nothing.

Thanks, I hope I fixed this now on emacs-29, please re-test.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60210; Package emacs. (Mon, 02 Jan 2023 15:29:01 GMT) Full text and rfc822 format available.

Message #46 received at 60210 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 60210 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60210: 30.0.50; tab-bar height not recalculated when face
 changes
Date: Mon, 02 Jan 2023 15:28:33 +0000
>
> Thanks, I hope I fixed this now on emacs-29, please re-test.
>

Thanks, it works now!  My guess that is was a rounding problem was right. 
But I'm curious: in *_change_tab_bar_height we set f->tab_bar_lines, and 
in redisplay_tab_bar we check w->total_lines.  Where is the former used to 
set the latter?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60210; Package emacs. (Mon, 02 Jan 2023 16:54:01 GMT) Full text and rfc822 format available.

Message #49 received at 60210 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 60210 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60210: 30.0.50; tab-bar height not recalculated when face
 changes
Date: Mon, 02 Jan 2023 18:53:00 +0200
> Date: Mon, 02 Jan 2023 15:28:33 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: 60210 <at> debbugs.gnu.org, juri <at> linkov.net
> 
> > Thanks, I hope I fixed this now on emacs-29, please re-test.
> 
> Thanks, it works now!  My guess that is was a rounding problem was right. 
> But I'm curious: in *_change_tab_bar_height we set f->tab_bar_lines, and 
> in redisplay_tab_bar we check w->total_lines.  Where is the former used to 
> set the latter?

In adjust_frame_size and its subroutines, I guess.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60210; Package emacs. (Wed, 04 Jan 2023 13:54:02 GMT) Full text and rfc822 format available.

Message #52 received at 60210 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 60210 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60210: 30.0.50; tab-bar height not recalculated when face
 changes
Date: Wed, 04 Jan 2023 13:53:36 +0000
>>> Thanks, I hope I fixed this now on emacs-29, please re-test.
>>
>> Thanks, it works now!  My guess that is was a rounding problem was 
>> right. But I'm curious: in *_change_tab_bar_height we set 
>> f->tab_bar_lines, and in redisplay_tab_bar we check w->total_lines. 
>> Where is the former used to set the latter?
>
> In adjust_frame_size and its subroutines, I guess.
>

Thanks, I'll have a look.  The person who sent me the bug report confirmed 
that the bug is also fixed with his configuration, so all is well.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 02 Feb 2023 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 190 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.