Subject: bug#24124: emacs terminal escape command error

From: Eli Zaretskii <[email-masked]>
Date: Thu, 04 Aug 2016 20:07:16 +0300

> From: modem <[email-masked]>
> Date: Wed, 3 Aug 2016 15:21:24 +0200
> 
> > I think you disabled the wrong code.  What you need is force Emacs to
> > always do this:
> > 
> >       if (cost <= relcost)œ
> > 	{	/* really is cheaper */
> > 	  emacs_tputs (tty, p, 1, cmputc);
> > 	  curY (tty) = row, curX (tty) = col;
> > 	  return;
> > 	}
> 
> Hi Eli,
> 
> Thanks a lot. So I did another patch and another try. I can still
> reproduce the bug.
> 
> Any more advices on stuff I should try are welcomed ;-)

I'm stumped.  It could be some problem with some other piece of
software, not with Emacs.

Is there someone you could ask to produce a human-readable description
of the command Emacs sent to the terminal driver, both in the "good"
and in the "bad" cases?  I mean this citation which you brought
originally, but without any details:

> I am attaching a snippet of the technical detail about this issue :
> 
> >  When you ^Z, tmux gets 112 bytes in all cases:
> >
> >  input_parse: %0 ground, 40 bytes:
> \n\n\033[K\033[?1l\033>\033[34h\033[?25h\033[?1049l\033[39;49m\r
> >  input_parse: %0 ground, 72 bytes: \r\n[1]+  Stopped
> emacs large_text_file.txt\r\nroot@milu:~#
> >
> >  \033[?1049l is rmcup which exits cursor positioning (alternate
> screen) mode.
> >
> >  Then when you type fg, it gets:
> >
> >  input_parse: %0 ground, 694 bytes:
> \033[?1049h\033[34l\033[?1h\033=\033[24;1H\033[K\033[H\033[?25l\033[3mFile
> Edit Options Buffers ...
> >
> >  \033[?1049h is smcup which turns it on again.
> >
> >  But sometimes, it gets:
> >
> >  input_parse: %0 ground, 674 bytes:
> \033[24;1H\033[K\033[H\033[?25l\033[3mFile Edit Options Buffers ...
> >
> >  Where emacs is not sending \033[1049h, or in fact any of the smcup,
> >  cvvis, smkx sequence it normally sends.

It would be nice to be able to understand what was meant by whoever
wrote this, as smcup, cvvis, etc. don't tell me much (I'm not a
terminfo expert).

Thanks.