Subject: bug#45042: 27.1; emacs -nw on Windows does not always update cursor position on screen

From: Ed Avis <[email-masked]>
Date: Fri, 4 Dec 2020 18:53:28 +0000

I installed the GNU Emacs build for Microsoft Windows x86_64 from the
GNU FTP site.  Rather than the graphical interface I am running it in
text mode using 'emacs.exe -nw'.  If run from the ancient Windows
command prompt (cmd.exe) this works well.  But in other terminal
emulators there is a strange problem where the cursor position is not
always updated.

For example, run Emacs inside the Alacritty terminal emulator.  Moving
point up and down with the arrow keys (or C-p and C-n) works, but moving
left and right (with arrows, C-b, C-f) does not update the visible
cursor on screen.  Point did move, as you can see by typing some
characters, and the visible cursor will update when you move up or down,
but horizontal movement doesn't seem to display.

If this were just one terminal emulator I would not suggest it as a bug
in Emacs, but the same thing happens when running an ssh server on the
Windows machine and running emacs -nw over ssh from another Windows
machine.  The cursor movement problem happens whether the ssh client is
OpenSSH (ssh.exe) running in cmd.exe, or ssh.exe running in Alacritty,
or from PuTTY (which combines ssh client and terminal emulator).

Quick experiments with setting TERM to 'vt100' instead of 'xterm' did
not find a fix.  Is there something Emacs can do to make sure the cursor
position on screen is always updated?

In GNU Emacs 27.1 (build 1, x86_64-w64-mingw32)
 of 2020-08-21 built on CIRROCUMULUS
Repository revision: 86d8d76aa36037184db0b2897c434cdaab1a9ae8
Repository branch: HEAD
Windowing system distributor 'Microsoft Corp.', version 10.0.18363
System Description: Microsoft Windows 10 Pro (v10.0.1909.18363.1198)

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2
HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: ENG
  locale-coding-system: cp1252

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
term/w32console tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win
w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads w32notify w32 lcms2 multi-tty make-network-process
emacs)

Memory information:
((conses 16 43590 9530)
 (symbols 48 6020 1)
 (strings 32 15201 1632)
 (string-bytes 1 502900)
 (vectors 16 6718)
 (vector-slots 8 78458 6176)
 (floats 8 18 317)
 (intervals 56 187 0)
 (buffers 1000 12))

This email and any files transmitted with it are CONFIDENTIAL and are intended solely for the use of the individual(s) or entity to whom they are addressed. Any unauthorized copying, disclosure or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this email are solely those of the author and do not necessarily represent those of QMA Wadhwani LLP (QMAW) unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding agreement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original. Telephone, electronic and other communications and conversations with QMAW and/or its associated persons may be recorded and retained. QMAW is authorized and regulated by the Financial Conduct Authority. QMAW (registered in England No. OC303168) has its registered office at 9th Floor Orion House, 5 Upper St Martin's Lane, London, WC2H 9EA.

Please note that your personal information may be stored and processed in any country where we have facilities or in which we engage service providers. If you provide personal information to us by email or otherwise, you consent to the transfer of that information to countries outside of your country of residence and these countries may have different data protection rules than your country.'

To learn about our privacy policies, please use this link<https://www.pgim.com/disclaimer/privacy-center> to read the PGIM Privacy Notice.