public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: [ANNOUNCEMENT] Updated: mintty 3.1.6
Date: Fri, 22 May 2020 23:56:32 +0900	[thread overview]
Message-ID: <20200522235632.16c7c562d74050b8f1e7c705@nifty.ne.jp> (raw)
In-Reply-To: <20200522225405.f8369e7698766d8633ba87de@nifty.ne.jp>

On Fri, 22 May 2020 22:54:05 +0900
Takashi Yano via Cygwin <cygwin@cygwin.com> wrote:
> On Fri, 22 May 2020 21:58:00 +0900
> Takashi Yano via Cygwin <cygwin@cygwin.com> wrote:
> > On Fri, 22 May 2020 20:01:31 +0900
> > Takashi Yano via Cygwin <cygwin@cygwin.com> wrote:
> > > On Fri, 22 May 2020 12:14:43 +0200
> > > Thomas Wolff wrote:
> > > > Hi Takashi,
> > > > 
> > > > Am 22.05.2020 um 11:22 schrieb Takashi Yano via Cygwin:
> > > > > Hi Thomas,
> > > > >
> > > > > On Thu, 21 May 2020 19:41:27 +0200
> > > > > Thomas Wolff wrote:
> > > > >> I have uploaded mintty 3.1.6 with the following changes:
> > > > >>
> > > > >> Window handling
> > > > >>     * Fixed resource leak when displaying images (#995).
> > > > >>     * Fixed crash condition on keyboard auto-repeat (#996). (Apologies
> > > > >> for this one.)
> > > > >>
> > > > >> The homepage is at http://mintty.github.io/
> > > > >> It also links to the issue tracker.
> > > > > After v3.1.5, the key repeat rate becomes almost halfened.
> > > > > Is this behaviour by design?
> > > > >
> > > > > The key repeat rate is about 30 chars/sec in v3.1.4, but
> > > > > it is 15 chars/sec in v3.1.5 and v3.1.6.
> > > > >
> > > > > It is little bit flustrating in editor cursor movement.
> > > > >
> > > > I've uploaded a commit: keyboard auto-repeat handling is now unaffected 
> > > > by default
> > > > Explanation: the new auto-repeat rate limitation with a maximum of 30 
> > > > cps (following the DECARR sequence of VT520) was effectively slowing 
> > > > down keyboards; I had the impression 30 would be enough... sorry
> > > 
> > > I also think 30 cps would be enough, however, the key repeat rate
> > > is not as setting by ESC[n-p sequence. Measured results in v3.1.6
> > > are as follows. Actual key repeat rate does not increase linearly.
> > > 
> > > ^[[1-p  : 1 cps
> > > ^[[2-p  : 2 cps
> > > ^[[3-p  : 3 cps
> > > ^[[5-p  : 4.7cps
> > > ^[[10-p : 8.2cps
> > > ^[[20-p : 14.8cps
> > > ^[[30-p : 16.3cps
> > 
> > Revising code in wininput.c as follows resolve this problem.
> > 
> > static LONG last_key_time = 0;
> > static LONG last_message_time = 0;
> > 
> >   LONG message_time = GetMessageTime();
> >   LONG last_key_time_new = message_time;
> >   if (repeat) {
> > #ifdef auto_repeat_cursor_keys_option
> >     switch (key) {
> >       when VK_PRIOR ... VK_DOWN: do not return...;
> >     }
> > #endif
> >     if (!term.auto_repeat)
> >       return true;
> >     if (message_time - last_message_time < 2*1000/term.repeat_rate)
> >       /* Key repeat seems to be continued. */
> >       last_key_time_new = last_key_time + 1000/term.repeat_rate;
> >     last_message_time = message_time;
> >     if (message_time - last_key_time < 1000/term.repeat_rate)
> >       return true;
> >   }
> >   last_key_time = last_key_time_new;
> > 
> > ^[[1-p   : 1 cps
> > ^[[2-p   : 2 cps
> > ^[[3-p   : 3 cps
> > ^[[5-p   : 5 cps
> > ^[[10-p  : 9.7cps
> > ^[[20-p  : 19.4cps
> > ^[[30-p  : 29.0cps
> 
> The simplified following code also work as expected.
> Protection for division by 0 is added as well.
> 
> static LONG last_key_time = 0;
> 
>   LONG message_time = GetMessageTime();
>   if (repeat) {
> #ifdef auto_repeat_cursor_keys_option
>     switch (key) {
>       when VK_PRIOR ... VK_DOWN: do not return...;
>     }
> #endif
>     if (!term.auto_repeat)
>       return true;
>     if (term.repeat_rate &&
>         message_time - last_key_time < 1000 / term.repeat_rate)
>       return true;
>   }
>   if (term.repeat_rate &&
>       message_time - last_key_time < 2*1000 / term.repeat_rate)
>     /* Key repeat seems to be continued. */
>     last_key_time += 1000 / term.repeat_rate;
>   else
>     last_key_time = message_time;

Sorry again and again. After all, the code above doesn't work
as expected. I would like to propose the code below.

static LONG last_key_time = 0;

  LONG message_time = GetMessageTime();
  if (repeat) {
#ifdef auto_repeat_cursor_keys_option
    switch (key) {
      when VK_PRIOR ... VK_DOWN: do not return...;
    }
#endif
    if (!term.auto_repeat)
      return true;
    if (term.repeat_rate &&
        message_time - last_key_time < 1000 / term.repeat_rate)
      return true;
  }
  if (term.repeat_rate && repeat &&
      message_time - last_key_time < 2*1000 / term.repeat_rate)
    /* Key repeat seems to be continued. */
    last_key_time += 1000 / term.repeat_rate;
  else
    last_key_time = message_time;

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

  reply	other threads:[~2020-05-22 14:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-21 17:41 Thomas Wolff
2020-05-22  9:22 ` Takashi Yano
2020-05-22 10:14   ` Thomas Wolff
2020-05-22 11:01     ` Takashi Yano
2020-05-22 12:58       ` Takashi Yano
2020-05-22 13:54         ` Takashi Yano
2020-05-22 14:56           ` Takashi Yano [this message]
2020-05-22 20:16             ` Thomas Wolff
2020-05-26 14:30 ` David Dombrowsky
2020-05-26 14:49   ` Thomas Wolff
2020-05-26 15:15     ` Randall Nutz
2020-05-26 15:31       ` Thomas Wolff
     [not found]         ` <CAMVJNJuDbQ=Y5qCy=C8rUSaqnA+MXszrJqbAWdyM5YFfAK7Wdw@mail.gmail.com>
2020-05-26 17:14           ` Thomas Wolff
2020-05-26 19:16             ` Maarten Hoes
2020-05-26 19:53               ` Marco Atzeri
2020-05-26 20:18                 ` Maarten Hoes
2020-05-26 20:36               ` Brian Inglis
2020-05-26 21:00                 ` Maarten Hoes

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

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

  git send-email \
    --in-reply-to=20200522235632.16c7c562d74050b8f1e7c705@nifty.ne.jp \
    --to=takashi.yano@nifty.ne.jp \
    --cc=cygwin@cygwin.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.
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).