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 23983
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- Subject: Re: A function to display message under the prompt without zle active
- Date: Sat, 22 Jun 2019 23:17:43 +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=lIWUrcH4mNfeE+D+AkQm5GBKV62PHziejJpvl/hHU6Q=; b=fJKiFqDTaB8lJLgovF+1sAormfwgr0yFUZ+EIE1+ao/vEpZVeEDcM1qC/z0EBo7QQh /Aq0yfMb94KlT/4mwonS5tWKKgOoLtpoj/dYOAClEjqdbOi/mjkCeRUnzngLFfmv1Ei0 hUTptSGig1zNRfKjxbCgKsZdyFfe8nFT1beXLXs8plgoLc1DgkExxsptUkoGT5gR2fqP qyI9rYUafB/p0KtDpYJr7cLxskkeT+gf1lodgFSvYi2C8u//PSdfC4oWtGQrO4m1Xh2e KzAs4jget211IvOAOQolxlI5bRZlEb0nzWTXfBGIRA0Zpy9IXmwllGCqCIBhcvm0GvHR 8zcA==
- In-reply-to: <CAKc7PVCtKKx-Toy+5gJ_uHoaXVBwQXgPyvtUFs7F55fwneXHsg@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>
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.
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author