Subject: bug#38016: 27.0.50; Display issues with delay-warning and side-by-side windows in terminal

From: Eli Zaretskii <[email-masked]>
Date: Fri, 01 Nov 2019 17:57:34 +0200

> Date: Fri, 01 Nov 2019 15:13:00 +0200
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked]
> 
> > From: Tom Levy <[email-masked]>
> > Date: Sat, 2 Nov 2019 01:29:22 +1300
> > Cc: [email-masked]
> > 
> >   emacs -Q -nw --eval '(progn
> >     (setq truncate-partial-width-windows nil)
> >     (setq initial-scratch-message ";; short\n;; message\n\n")
> >     (setq split-height-threshold 80)
> >     (setq split-width-threshold 20)
> >     (delay-warning :debug "line 1\nline 2"))'
> > 
> > Results:
> > 
> >     $LINES  first value of $COLUMNS with glitch
> >     18      155
> >     19      149
> >     24      129
> >     37      99
> >     48      89
> 
> Thanks, now I see this and will look into it when I have time.

Looks like some weird problem with cursor motion commands Emacs emits
on a TTY.  As screen dimension change, Emacs tries to optimize the
commands it sends, and changes the commands it emits to put the cursor
at given display coordinates, see cm.c:cmgoto.  Probably related to
bug#24124 (which remains unresolved).

The way to record the commands Emacs sends to the terminal is to
invoke open-termscript.  The commands will be in the file this
function gets as its 2nd argument.

We need a terminfo expert to find out what's wrong here.  Anyone?