Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: A function to display message under the prompt without zle active
- X-seq: zsh-users 23985
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Subject: Re: A function to display message under the prompt without zle active
- Date: Sat, 22 Jun 2019 23:31:42 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CnBsB6A9ITnAEaq1H/EFhZkr1czriRb3IdtVmJNY8yk=; b=UmwElKhn4FBNM+EhtymHxd54oZHfrVu6W39K2iw2tnb6MggVPqcC5smSCXEYGTUvhr jn1E6HR5VwyNgmBBtEwgUhW3WVVxUkM1ILIBm+kh1m7zLKqzbiOHdjShSapomL1nNd/o ko+EC6se2pwMDITo3FQ8u/yk+6UxdgRfLBFNk2GZGS1L2nXrMu4Zto641qb0mhcgD3CJ Hka5cu+jnBN1KtDb54ADvsaC6sdP0kHB0NpIfUX78yTECng7wf5KIpfc3BBriXDNzqVy dReV2qxM3O2nZckElQTLPIsyxjzDob0uWL7GVLn6cRJizC5Ab8mM2T5vVtgmMKQSh0SS gVPg==
- In-reply-to: <CAN=4vMrkkYfZ3nnjy3a+RE=W1pO+UJ4aU=0NT5EDekd+x0kJRg@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVA4gB_6FqObagdn8EBrFLdrUfJVAFHMyph2=YXUDWtExg@mail.gmail.com> <CAN=4vMr4iXsCAOvw5a=ZNSKL=LDYA9UjD8HnJv-A1bRxs0BL2A@mail.gmail.com> <CAKc7PVCtKKx-Toy+5gJ_uHoaXVBwQXgPyvtUFs7F55fwneXHsg@mail.gmail.com> <CAN=4vMrkkYfZ3nnjy3a+RE=W1pO+UJ4aU=0NT5EDekd+x0kJRg@mail.gmail.com>
On Sat, 22 Jun 2019 at 23:17, Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
> On Sat, Jun 22, 2019 at 10:49 PM Sebastian Gniazdowski
> <sgniazdowski@xxxxxxxxx> wrote:
> >
> > The command line seems to be blcoked after first using the descriptor.
>
> Silly bugs. This isn't production code, I just typed it into GMail to
> give an idea. Removing `while` should fix it. There is also a missing
> `local` and quotes. With these fixes in place:
>
> function _zle_msg_process() {
> emulate -L zsh
> local line
> IFS='' read -r -u $zle_msg_fd line && zle -M $line
> }
>
> The rest of the code stays the same. The nice thing about this
> implementation is that it's fork-free.
Thanks for the code, this distinct property might get handy in some situations.
> Depending on your needs you might also want to open the file descriptor
> with `sysopen -rw -o cloexec`.
>
> Note that zle will hang if you write something to the file descriptor
> without a terminating \n.
>
> Roman.
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author