Subject: bug#79298: patch: full color in windows terminal

From: Eli Zaretskii <[email-masked]>
Date: Wed, 03 Sep 2025 17:44:48 +0300

> Date: Wed, 03 Sep 2025 09:35:37 +0000
> From: Ewan <[email-masked]>
> Cc: [email-masked]
> 
> I'm still waiting on a disclaimer, but in the meantime, I have attached 
> the revised patch (with a slightly broadened scope).

Thanks.

> Basically, it's much smoother to do a wholesale migration from the Windows
> Console API to ASCII control sequences, controlled by an auto-set feature flag.
> 
> However,
> 
> (1) ASCII control sequences require moving the cursor during redisplay,
> (2) the Windows system cursor picks up these movements, and
> (3) redisplay is slow enough that cursor jumps to the echo area are perceptible.
> 
> So, I've also implemented some changes to cursor handling in Windows TTY.
> 
> If the existing variable 'w32-use-visible-system-caret is nil (the default),
> then we always hide the system cursor, and Emacs handles cursor display.
> This is the smoothest UX, currently limited to a non-blinking solid cursor.
> Otherwise, the system cursor is used, but we hide it momentarily when
> redisplaying the echo area, resulting in a slight cursor flicker in-place
> (the alternative being a noticeable "flashing" of the cursor in the echo area).

I wish you brought this up for discussion before actually coding (and
documenting) these extensive changes.  I'd rather we stayed with the
original use of the Windows Console APIs for everything except the
true color support, if possible.  AFAIK, there are no fundamental
incompatibilities between these two features (if I'm mistaken, please
describe the problems), and we need to keep the old Console APIs
anyway for as long as we support the older Windows systems.  Plus,
AFAIK users can choose to use the legacy ConHost even on newer Windows
versions, and I wouldn't want us to have to tell the users to tweak
their Emacs should it turn out ConHost causes problems with the
Virtual Terminal control sequences.  And you have already bumped into
problems with this, in the form of cursor flashing momentarily in the
wrong places and slower redisplay.

In addition, the changes you propose introduce Windows-specific code
into platform-independent source files, like dispnew.c, something we
generally prefer to avoid.

So let's take a step back and discuss the need for this part of the
changes: what problems will we encounter if we leave cursor handling
and the rest of console management to the old Console APIs, and use
the new ASCII sequences only for true color?  If the problems are not
too hard to solve, I'd prefer to leave that code alone, with minimal
necessary changes.  If nothing else, it leaves use with code which was
tested by many users during a long time.

Thanks again for working on this.