From: Bart Schaefer <schaefer@brasslantern.com>
To: Ray Andrews <rayandrews@eastlink.ca>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: read -sq
Date: Sun, 21 Feb 2021 13:00:19 -0800 [thread overview]
Message-ID: <CAH+w=7baLKnMRd5wiA+aGnU9aomMG378A=+O8hWuntXxZ1ep+A@mail.gmail.com> (raw)
In-Reply-To: <b50a8fcb-65d2-02c3-ab93-0ceb7a067fe0@eastlink.ca>
On Sun, Feb 21, 2021 at 9:54 AM Ray Andrews <rayandrews@eastlink.ca> wrote:
>
> Yeah, one keystroke is not the same as one character. I wonder if you
> could tell it to take whatever comes within an instant and treat that like one
> character?
Depending on where/why you're using "read -q", you can potentially get
this effect by using "zle read-command" instead.
read-sq-init () {
zle read-command
BUFFER=${KEYS[1]}
zle -U $'\n'
}
zle -N read-sq-init
read-sq () {
: ${(P)${1:-REPLY}::=''}
if zle
then
zle read-command
: ${(P)${1:-REPLY}::=${KEYS[1]}}
else
vared -i read-sq-init ${1:-REPLY}
fi
if [[ ${(P)${1:-REPLY}} = [Yy] ]]
then
: ${(P)${1:-REPLY}::=y}
return 0
else
: ${(P)${1:-REPLY}::=n}
return 1
fi
}
next prev parent reply other threads:[~2021-02-21 21:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-21 16:41 Ray Andrews
2021-02-21 17:31 ` Bart Schaefer
2021-02-21 17:54 ` Ray Andrews
2021-02-21 21:00 ` Bart Schaefer [this message]
2021-02-21 21:58 ` Ray Andrews
2021-02-21 23:03 ` Bart Schaefer
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='CAH+w=7baLKnMRd5wiA+aGnU9aomMG378A=+O8hWuntXxZ1ep+A@mail.gmail.com' \
--to=schaefer@brasslantern.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).