Subject: bug#17497: 24.4.50; TTY menu glitches

From: Stefan Monnier <[email-masked]>
Date: Wed, 04 Jun 2014 09:06:11 -0400

>> > repeating: if the cursor-key sequence of characters is misinterpreted
>> > (for example due to timeouts), then fragments of the sequences will
>> > echo as unexpected characters.
>> I do not understand what that means.  By "cursor-key sequence of
>> characters" do you mean the escape sequence sent by the terminal to
>> Emacs or the cursor-motion escape sequences sent from Emacs to the
>> text terminal?
> From the terminal to Emacs.
> Cursor up typically is
> 	ESC [ A
> three characters.

But that's a completely different problem from the one
we're investigating.  The problem is about how the terminal emulator
reacts to Emacs's output, not how Emacs reacts to the terminal
emulator's output.

> Curses applications behave differently if you type those
> three characters, one-by-one, because of timing.

We try pretty hard to avoid using such timeouts in Emacs, so by and
large this doesn't apply to Emacs at all.

> That's part of it.  Usually the input (from the terminal to the application)
> is more important.

But the present bug-report is about the other case.
To repeat the problem:
- a particular run of Emacs sends bytes <typescript> to the terminal
  emulator, and the result doesn't look right.
- yet when we replay the same <typescript> directly to the terminal, the
  result looks correct.
Note also that (other than the display), the state of Emacs at the end
of the test is correct (and forcing a redisplay indeed fixes the
display), so the problem is not in Emacs misinterpreting input because
of timing issues.

        Stefan