zsh-users
 help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Ray Andrews <rayandrews@eastlink.ca>
Cc: zsh-users@zsh.org
Subject: Re: one time in 20 error
Date: Wed, 30 Nov 2022 15:10:21 +0100	[thread overview]
Message-ID: <CAN=4vMr86vz9UD0W=1dHvL1p8QH7i3gKiun=V57OcKOLSRY99g@mail.gmail.com> (raw)
In-Reply-To: <57e8e248-bb1a-663a-8557-e3fc13f671d4@eastlink.ca>

On Wed, Nov 30, 2022 at 2:57 PM Ray Andrews <rayandrews@eastlink.ca> wrote:
>
> I can press and hold the button, wait for the program to end (so far mouse
> clicks always make a selection from a list and return) and then release the
> button and, again, maybe one time in 20 I'll get the bogey.  I've tried
> variation on click speed but nothing  makes it better or worse.   You don't
> suppose it could be a mechanical issue with the mouse?  You know how they
> sometimes get sticky and mouse clicks are poorly registered?  I've had mice
> that tended to return two clicks when only one was made.  A mechanically
> unclean release seems to confuse the computer.

What happens is that you click while the script is running and
listening to mouse events, this causes the terminal to send you data,
which can take arbitrary long to arrive to your script's stdin. Then
the script deactivates mouse tracking and exists, and then the data
from the past click reaches stdin. Clicks after the script exits won't
generate any data because mouse tracking is already disabled.

> Well, so far the 'timeout' is working 100%

It won't work if you run your script over SSH with high latency.
Moreover, it adds lag every time the script exists. A better solution
is what I posted above. It doesn't add more latency than necessary and
will correctly clear stdin with any amount of latency between your
script and the terminal. The code I posted needs to be run when the
script ends. If your script disables mouse tracking on its own, you
can remove the first two `print` statements from my code snippet.

Roman.


  reply	other threads:[~2022-11-30 14:13 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 17:40 Ray Andrews
2022-11-28 17:54 ` Roman Perepelitsa
2022-11-28 20:34   ` Ray Andrews
2022-11-28 20:46     ` Roman Perepelitsa
2022-11-28 22:16       ` Ray Andrews
2022-11-28 22:24         ` Roman Perepelitsa
2022-11-28 23:18           ` Ray Andrews
2022-11-29  2:48 ` Risto Laitinen
2022-11-29  3:27   ` Ray Andrews
2022-11-29 10:13   ` Roman Perepelitsa
2022-11-29 13:29     ` Ray Andrews
2022-11-30  4:32       ` Bart Schaefer
2022-11-30 13:56         ` Ray Andrews
2022-11-30 14:10           ` Roman Perepelitsa [this message]
2022-11-30 20:23             ` Ray Andrews
2022-11-30 23:17               ` Ray Andrews
2022-11-30 23:46                 ` Bart Schaefer
2022-12-01  0:03           ` Bart Schaefer
2022-12-01  3:20             ` Ray Andrews
2022-12-01  9:19               ` Roman Perepelitsa
2022-12-01 14:35                 ` Ray Andrews
2022-12-01 14:42                   ` Philippe Altherr
2022-12-01 21:19                     ` Ray Andrews

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='CAN=4vMr86vz9UD0W=1dHvL1p8QH7i3gKiun=V57OcKOLSRY99g@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /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.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).