Subject: Re: bug#76852: 30.1; Regression in whitespace-mode causes display issue under terminal

From: 张海 <[email-masked]>
Date: Wed, 12 Mar 2025 23:49:17 -0700

> The change was intentional, but it follows the Unicode data tables, so
> evidently some characters which were previously half-width because
> full-width by default in Emacs 30.  Thus, the NEWS text is indeed
> slightly misleading.

Does that mean the solution should be users who use a CJK locale will
need to set cjk-ambiguous-chars-are-wide to nil in order for
whitespace-mode to work?

It seems to me this might mean most users with a CJK locale will need
to do that if they ever use whitespace-mode, because it never makes
sense for the whitespace replacement char (the middle dot) to occupy
the space of two characters.

> Hmm... does gnome-console have any configuration options for this?  It
> sounds like it assumes these characters are half-width regardless of
> what the font does.  This URL:
>
>  https://superuser.com/questions/573876/how-to-let-gnome-terminal-to-use-specific-font-to-display-punctuations-in-their
>
> seems to imply you should be able to control this aspect of the
> terminal.

I can confirm this does allow the middle dot to show up as two
characters wide (even without a font change), which looks strange but
does make line wrapping and editing work.

On Wed, Mar 12, 2025 at 7:21 AM Eli Zaretskii <[email-masked]> wrote:
>
> > From: 张海 <[email-masked]>
> > Date: Tue, 11 Mar 2025 21:56:00 -0700
> > Cc: [email-masked]
> >
> > > That rings a bell.  What happens if, before turning on whitespace-mode
> > > for the first time in a session, you customize the variable
> > > cjk-ambiguous-chars-are-wide to the nil value?  This must be done
> > > either via setopt or interactively via customize-option, not via setq.
> > > Does the problem go away if you do that, and then turn on
> > > global-whitespace-mode?
> >
> > I can confirm this does make the issue go away.
>
> OK, so we now at least understand what caused the issue.
>
> > But looking at the NEWS announcement for cjk-ambiguous-chars-are-wide,
> > it seems to suggest the previous default was already full-width, which
> > conflicts with the fact that whitespace-mode was working fine in
> > terminal in Emacs 29.4 under a CJK locale. So was there an
> > unintentional default behavior change, and should that be fixed?
>
> The change was intentional, but it follows the Unicode data tables, so
> evidently some characters which were previously half-width because
> full-width by default in Emacs 30.  Thus, the NEWS text is indeed
> slightly misleading.
>
> > > Can you look for a font where the characters U+00B7 MIDDLE DOT and
> > > U+00A4 CURRENCY SIGN have fullwidth glyphs?  I presume some
> > > CJK-specific fonts should be like that, since these characters are
> > > referred to as having "ambiguous width" in the Unicode character
> > > database.  If you can find such a font, please try setting up
> > > gnome-console to use it, and see if the problem then goes away.
> >
> > No, the same issue persisted and the only difference is that this time
> > only the first half of the full-width middle dot was rendered.
>
> Hmm... does gnome-console have any configuration options for this?  It
> sounds like it assumes these characters are half-width regardless of
> what the font does.  This URL:
>
>   https://superuser.com/questions/573876/how-to-let-gnome-terminal-to-use-specific-font-to-display-punctuations-in-their
>
> seems to imply you should be able to control this aspect of the
> terminal.
>