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

From: Ewan <[email-masked]>
Date: Wed, 03 Sep 2025 09:35:37 +0000

I'm still waiting on a disclaimer, but in the meantime, I have attached 
the revised patch (with a slightly broadened scope).

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).

More details in the included news entries and changes to the manual.

Logs:
* doc/emacs/cmdargs.texi: Added 24-bit option and note re: --color on Windows.
* doc/emacs/msdos.texi: Documented VT sequence migration and feature flag(s).
* etc/NEWS.30: Entries on VT sequences (color) and cursor display.
* lisp/term/tty-colors.el: Added '24bit cell in tty-color-mode-alist.
* lisp/term/w32console.el: Changes/additions enabling VT sequence migration.
* src/dispnew.c: WINDOWSNT-specific segments for w32- and Emacs-drawn cursor(s).
* src/term.c: Extended existing TTY color infrastructure to include WINDOWSNT.
* src/termchar.h: Added extern decl. (tty_setup_colors) for use in w32console.c.
* src/w32console.c: Migration to ASCII control sequences (feature-flagged).
* src/xdisp.c: Modified #if condition to call set_tty_color_mode for WINDOWSNT.