Subject: Re: bug#76760: 31.0.50; Tab bar not updating on text property changes

From: Eli Zaretskii <[email-masked]>
Date: Wed, 05 Mar 2025 15:42:41 +0200

> From: Pengji Zhang <[email-masked]>
> Date: Wed, 05 Mar 2025 17:43:15 +0800
> 
> I found that currently a frame does not update the tab bar on text
> property changes. For example:
> 
>   - Start *GUI* Emacs with 'emacs -Q'
>   - Evaluate the following snippet:
> 
> --8<---------------cut here---------------start------------->8---
> (push #'tab-bar-format-global tab-bar-format)
> (tab-bar-mode)
> (read-passwd "Prompt: ")
> --8<---------------cut here---------------end--------------->8---
> 
>   - Press TAB while in the minibuffer.
> 
> Notice that the eye icon at the beginning of the tab bar does not change
> at all, while it should switch to the other icon.
> 
> Presumably this is due to the check starting at L14369 of 'src/xdisp.c':
> 
>     /* Redisplay the tab-bar if we changed it.  */
>     if (new_n_tab_bar != f->n_tab_bar_items
>         || NILP (Fequal (new_tab_bar, f->tab_bar_items)))
>     {...}
> 
> Text properties of strings are not examined in 'Fequal', so the old and
> the new bars are considered the same.

This can be easily modified to use equal-including-properties, as
below, but I wonder whether this perhaps could cause too-eager
redisplay of the tab bar in some cases where we don't want.  Juri,
WDYT?

diff --git a/src/xdisp.c b/src/xdisp.c
index 55c764f..b18e193 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -14368,7 +14368,8 @@ update_tab_bar (struct frame *f, bool save_match_data)
 
 	  /* Redisplay the tab-bar if we changed it.  */
 	  if (new_n_tab_bar != f->n_tab_bar_items
-	      || NILP (Fequal (new_tab_bar, f->tab_bar_items)))
+	      || NILP (Fequal_including_properties (new_tab_bar,
+						    f->tab_bar_items)))
             {
               /* Redisplay that happens asynchronously due to an expose event
                  may access f->tab_bar_items.  Make sure we update both