unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: dickey@his.com
Cc: 17497@debbugs.gnu.org
Subject: bug#17497: 24.4.50; TTY menu glitches
Date: Sun, 01 Jun 2014 19:25:29 +0300	[thread overview]
Message-ID: <838upgbnra.fsf@gnu.org> (raw)
In-Reply-To: <20140601152657.GA15078@aerie.jexium-island.net>

[I asked Thomas for his expert opinion on this strange issue, and he
graciously agreed.]

> Date: Sun, 01 Jun 2014 11:26:57 -0400
> From: Thomas Dickey <dickey@his.com>
> Cc: dickey@his.com
> 
> On Sun, Jun 01, 2014 at 06:07:33PM +0300, Eli Zaretskii wrote:
> > > Date: Sat, 31 May 2014 16:09:47 -0400
> > > From: Thomas Dickey <dickey@his.com>
> > > Cc: dickey@his.com
> > > 
> > > The discussion sounds like a common problem: terminals send cursor- and
> > > function-keys generally as a sequence of bytes, requiring an application
> > > to wait for each sequence to complete.  If each keystroke causes the
> > > application to do something that writes a lot of text to the screen (such
> > > as scrolling), it's possible to have some of those sequences timeout.
> > > Once that happens, the application doesn't see cursor-keys, it sees the
> > > individual bytes - which can be interpreted differently (including echoing
> > > and further messing up the display).
> > > 
> > > While I'm aware that Emacs doesn't use ncurses for screen optimization,
> > > which is the same issue implied in the description of ESCDELAY in the
> > > ncurses manpage, which begins
> > > 
> > >        ESCDELAY
> > >             Specifies the total time, in milliseconds, for  which  ncurses
> > >             will  await  a  character sequence, e.g., a function key.  The
> > >             default value, 1000 milliseconds, is  enough  for  most  uses.
> > >             However, it is made a variable to accommodate unusual applica‐
> > >             tions.
> > > 
> > >             The most common instance where you may  wish  to  change  this
> > >             value  is to work with slow hosts, e.g., running on a network.
> > >             If the host cannot read characters  rapidly  enough,  it  will
> > >             have  the  same effect as if the terminal did not send charac‐
> > >             ters rapidly enough.  The library will still see a timeout.
> > 
> > Thanks.
> > 
> > However, what puzzles me is that the code which implements text-mode
> > menus doesn't change at all how Emacs handles display on a TTY.  We
> > just overwrite portions of the display with the menu text in some
> > internal data structure, then hand out that structure to the code
> > which updates the screen, as if the buffer text has changed.  So how
> > come we never saw similar problems with normal Emacs display on a TTY,
> > e.g. when the user presses PgDn to scroll the text?
> 
> Scrolling one line at a time versus scrolling the whole page differs
> most noticeably if the application doesn't (or can't) use a terminal's
> scrolling features.  If it doesn't scroll, then the whole screen has to
> be repainted for each update.

Emacs optimizes redrawing by comparing the previous and the desired
display, and then only repainting the changed parts.

None of that changes when the menu is displayed, we just overwrite
portions of the desired display data structure, then call the normal
redrawing routines.  That's why it puzzles me why the problems are
being reported only for the menus.

> Repainting the screen after scrolling one line is going to be much slower
> than repainting the screen after scrolling one page.

Yes, I understand.  But repainting the menu when the user presses,
e.g., the down arrow, is no different: Emacs just repaints the
previously-selected menu item in the normal color, then repaints the
one below it in the "selected" color.  (Actually, since the menu item
is usually shorter than the terminal width, only part of each of those
2 lines is redrawn.)

> > Btw, is it OK to CC the Emacs bug tracker, so that this discussion is
> > recorded there?
> 
> yes

Thanks.  The 17497@debbugs.gnu.org address above will achieve that.





       reply	other threads:[~2014-06-01 16:25 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <83vbslbuqr.fsf@gnu.org>
     [not found] ` <20140531200947.GA779@aerie.jexium-island.net>
     [not found]   ` <83lhtgbrd6.fsf@gnu.org>
     [not found]     ` <20140601152657.GA15078@aerie.jexium-island.net>
2014-06-01 16:25       ` Eli Zaretskii [this message]
2014-06-01 17:12         ` bug#17497: 24.4.50; TTY menu glitches Thomas Dickey
2014-06-01 17:18           ` Thomas Dickey
2014-06-01 18:45             ` Eli Zaretskii
2014-06-01 19:46               ` Thomas Dickey
2014-06-02 15:17                 ` Eli Zaretskii
2014-06-02 16:14                   ` Glenn Morris
2014-06-02 16:43                     ` Eli Zaretskii
2014-06-02 16:46                       ` Glenn Morris
2014-06-02 16:56                         ` Eli Zaretskii
2014-06-02 17:05                           ` Glenn Morris
2014-06-03 13:43             ` Stefan Monnier
2014-06-03 18:47               ` Thomas Dickey
2014-06-03 21:07                 ` Eli Zaretskii
2014-06-03 22:21                   ` Thomas Dickey
2014-06-04  6:54                     ` Eli Zaretskii
2014-06-04  3:03                 ` Stefan Monnier
2014-06-04  8:31                   ` Thomas Dickey
2014-06-04  9:10                     ` Thomas Dickey
2014-06-04  9:38                       ` Eli Zaretskii
2014-06-04 10:16                         ` Eli Zaretskii
2014-06-04 16:08                           ` Glenn Morris
2014-06-04 16:15                             ` Eli Zaretskii
2014-06-04 16:09                         ` Glenn Morris
2014-06-04 16:23                           ` Eli Zaretskii
2014-06-04 17:10                           ` Eli Zaretskii
2014-06-04 13:06                     ` Stefan Monnier
2014-06-04 20:26                       ` Thomas Dickey
2014-06-05  0:47                         ` Stefan Monnier
2014-06-05  8:21                           ` Thomas Dickey
2014-06-05  8:29                             ` Andreas Schwab
2014-06-05 15:02                               ` Eli Zaretskii
2014-06-05 13:44                             ` Stefan Monnier
2014-06-05 13:47                             ` Stefan Monnier
2014-06-05 15:00                             ` Eli Zaretskii
2014-06-01 18:39           ` Eli Zaretskii
2014-05-15 12:26 Dmitry Antipov
2014-05-15 17:37 ` Eli Zaretskii
2014-05-16  6:36   ` Glenn Morris
2014-05-16  6:38     ` Glenn Morris
2014-05-16  6:53       ` Glenn Morris
2014-05-16  8:48         ` Eli Zaretskii
2014-05-16 15:47           ` Glenn Morris
2014-05-16 20:21             ` Eli Zaretskii
2014-05-17  9:56             ` Eli Zaretskii
2014-05-22  2:49               ` Eli Zaretskii
2014-05-22  5:44                 ` Glenn Morris
2014-05-22  7:51                   ` Andreas Schwab
2014-05-22 15:58                     ` Glenn Morris
2014-05-22 17:19                       ` Andreas Schwab
2014-05-22 17:29                         ` Glenn Morris
2014-05-22 17:53                           ` Eli Zaretskii
2014-05-22 16:19                   ` Eli Zaretskii
2014-05-22 16:26                     ` Glenn Morris
2014-05-22 16:46                       ` Eli Zaretskii
2014-05-30  9:22                         ` Eli Zaretskii
2014-05-31  2:22                           ` Glenn Morris
2014-05-31  8:20                             ` Eli Zaretskii
2014-05-31 17:35                               ` Glenn Morris
2014-06-01 15:11                               ` Eli Zaretskii
2014-06-03  4:51                                 ` Glenn Morris
2014-06-03  7:03                                   ` Eli Zaretskii
2014-05-22 16:43                     ` Eli Zaretskii
2014-05-22 16:54                       ` Glenn Morris
2014-05-22 17:07                         ` Eli Zaretskii
2014-05-16  9:42         ` Dmitry Antipov
2014-05-16 10:26           ` Eli Zaretskii
2014-05-16 10:46           ` Eli Zaretskii
2014-05-16 14:59             ` Dmitry Antipov
2014-05-16 15:26               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=838upgbnra.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=17497@debbugs.gnu.org \
    --cc=dickey@his.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).