bug#81489: 32.0.50; w32--terminal-is-conhost is nil in gui emacs.

Eli Zaretskii <[email protected]> Fri, 31 Jul 2026 18:36:02 +0300
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
> From: TAKAHASHI Yoshio <[email protected]>
> Cc: [email protected]
> Date: Fri, 31 Jul 2026 22:23:32 +0900
> 
> > Please try the new patch for characters.el below, which
> > _replaces_ the previous one, i.e. it is relative to the current Git
> > repository.  You need to rebuild Emacs after you modify characters.el.
> 
> Apply the new patch, rebuild, and it works as expected.  Thank you.

Thanks, I will install the changes soon.

> for my note:
> . install Microsoft Windows Terminal from Microsoft Store, version 1.24.11911.0.
> . set command prompt's font to "MS Gothic", and invoke "emacs -nw -Q a.el".
> . buffer a.el draws cjk ambiguous char in 2 columns (MS Gothic),
>   but Windoes Terminal treats it in 1 column.  
> . with narrow cjk ambiguous char font, it works intuitively.

This is set up so the font used by the Windows Terminal by default
produces correct results.  With the default font selected by the
Windows Terminal, the CJK ambiguous characters take up only 1 column,
not 2.  It would be good to be able to be sensitive to the font, but
AFAIU it is not easy (or even impossible) to know which font is used
by WT for CJK characters, and using MS Gothic for all of them makes
little sense.

So I guess this feature is currently limited to the Windows Terminal's
default font selection, and the default fonts of ConHost.

Maybe we should make cjk-ambiguous-chars-are-wide be a tristate
instead of a boolean, with the 3rd value overriding the
w32--terminal-is-conhost test.  This way, users who set up Windows
Terminal to use a font that draws CJK ambiguous characters as 2-column
could customize Emacs to do that.  But this is for Emacs 32, it's too
late now to add such features.

Alternatively, one could call update-cjk-ambiguous-char-widths by
hand.