diff mbox

Reduce curses escdelay from 1s to 0.2s

Message ID 1466610278-22670-1-git-send-email-samuel.thibault@ens-lyon.org
State New
Headers show

Commit Message

Samuel Thibault June 22, 2016, 3:44 p.m. UTC
By default, curses will only report single ESC key event after 1s delay,
since ESC is also used for keypad escape sequences. This however makes users
believe that ESC is not working. Reducing to 0.2s provides good enough user
experience, while still allowing 200ms for keypad sequences to get in, which
should be more than enough.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 ui/curses.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Peter Maydell June 22, 2016, 8:49 p.m. UTC | #1
On 22 June 2016 at 16:44, Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:
> By default, curses will only report single ESC key event after 1s delay,
> since ESC is also used for keypad escape sequences. This however makes users
> believe that ESC is not working. Reducing to 0.2s provides good enough user
> experience, while still allowing 200ms for keypad sequences to get in, which
> should be more than enough.

That the default delay is this massive seems like a bug in curses,
but I don't suppose it's likely to be changed at this point :-(

-- PMM
Samuel Thibault June 22, 2016, 9:06 p.m. UTC | #2
Peter Maydell, on Wed 22 Jun 2016 21:49:04 +0100, wrote:
> On 22 June 2016 at 16:44, Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:
> > By default, curses will only report single ESC key event after 1s delay,
> > since ESC is also used for keypad escape sequences. This however makes users
> > believe that ESC is not working. Reducing to 0.2s provides good enough user
> > experience, while still allowing 200ms for keypad sequences to get in, which
> > should be more than enough.
> 
> That the default delay is this massive seems like a bug in curses,

I guess it's a "feature" due to old sluggish terminals.

Samuel
Peter Maydell June 22, 2016, 9:11 p.m. UTC | #3
On 22 June 2016 at 22:06, Samuel Thibault <samuel.thibault@gnu.org> wrote:
> Peter Maydell, on Wed 22 Jun 2016 21:49:04 +0100, wrote:
>> On 22 June 2016 at 16:44, Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:
>> > By default, curses will only report single ESC key event after 1s delay,
>> > since ESC is also used for keypad escape sequences. This however makes users
>> > believe that ESC is not working. Reducing to 0.2s provides good enough user
>> > experience, while still allowing 200ms for keypad sequences to get in, which
>> > should be more than enough.
>>
>> That the default delay is this massive seems like a bug in curses,
>
> I guess it's a "feature" due to old sluggish terminals.

Even the old mechanical terminals like the ASR33 could do
at least five or six characters a second :-)

thanks
-- PMM
Samuel Thibault Oct. 15, 2016, 5:24 p.m. UTC | #4
Hello,

Peter Maydell, on Wed 22 Jun 2016 21:49:04 +0100, wrote:
> On 22 June 2016 at 16:44, Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:
> > By default, curses will only report single ESC key event after 1s delay,
> > since ESC is also used for keypad escape sequences. This however makes users
> > believe that ESC is not working. Reducing to 0.2s provides good enough user
> > experience, while still allowing 200ms for keypad sequences to get in, which
> > should be more than enough.
> 
> That the default delay is this massive seems like a bug in curses,
> but I don't suppose it's likely to be changed at this point :-(

So, could this be applied?  Otherwise e.g. DOS applications ESC actions
are very slugguish and thus look bogus in the ncurses UI.

Samuel
Gerd Hoffmann Oct. 26, 2016, 12:51 p.m. UTC | #5
On Sa, 2016-10-15 at 19:24 +0200, Samuel Thibault wrote:
> Hello,
> 
> Peter Maydell, on Wed 22 Jun 2016 21:49:04 +0100, wrote:
> > On 22 June 2016 at 16:44, Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:
> > > By default, curses will only report single ESC key event after 1s delay,
> > > since ESC is also used for keypad escape sequences. This however makes users
> > > believe that ESC is not working. Reducing to 0.2s provides good enough user
> > > experience, while still allowing 200ms for keypad sequences to get in, which
> > > should be more than enough.
> > 
> > That the default delay is this massive seems like a bug in curses,
> > but I don't suppose it's likely to be changed at this point :-(
> 
> So, could this be applied?  Otherwise e.g. DOS applications ESC actions
> are very slugguish and thus look bogus in the ncurses UI.

Somehow slipped through and not in my qemu-devel folder any more.
Can you resend?

thanks,
  Gerd
Samuel Thibault Oct. 26, 2016, 3:20 p.m. UTC | #6
Gerd Hoffmann, on Wed 26 Oct 2016 14:51:00 +0200, wrote:
> On Sa, 2016-10-15 at 19:24 +0200, Samuel Thibault wrote:
> > Peter Maydell, on Wed 22 Jun 2016 21:49:04 +0100, wrote:
> > > On 22 June 2016 at 16:44, Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:
> > > > By default, curses will only report single ESC key event after 1s delay,
> > > > since ESC is also used for keypad escape sequences. This however makes users
> > > > believe that ESC is not working. Reducing to 0.2s provides good enough user
> > > > experience, while still allowing 200ms for keypad sequences to get in, which
> > > > should be more than enough.
> > > 
> > > That the default delay is this massive seems like a bug in curses,
> > > but I don't suppose it's likely to be changed at this point :-(
> > 
> > So, could this be applied?  Otherwise e.g. DOS applications ESC actions
> > are very slugguish and thus look bogus in the ncurses UI.
> 
> Somehow slipped through and not in my qemu-devel folder any more.
> Can you resend?

I have bounced it, (its "Date:" is 22 Jun 2016).

Samuel
diff mbox

Patch

diff --git a/ui/curses.c b/ui/curses.c
index b475589..49d3ce6 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -222,7 +222,7 @@  static void curses_refresh(DisplayChangeListener *dcl)
         keycode = curses2keycode[chr];
         keycode_alt = 0;
 
-        /* alt key */
+        /* alt or esc key */
         if (keycode == 1) {
             nextchr = getch();
 
@@ -349,6 +349,7 @@  static void curses_setup(void)
     initscr(); noecho(); intrflush(stdscr, FALSE);
     nodelay(stdscr, TRUE); nonl(); keypad(stdscr, TRUE);
     start_color(); raw(); scrollok(stdscr, FALSE);
+    set_escdelay(200);
 
     /* Make color pair to match color format (3bits bg:3bits fg) */
     for (i = 0; i < 64; i++) {