Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: print to the terminal in zle
- X-seq: zsh-users 17897
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- Subject: Re: print to the terminal in zle
- Date: Sat, 27 Jul 2013 17:30:55 +0100
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=P0CEhRsDqK01GnPGHO35q/M97Qc0AsBWhMLCAQxe5gM=; b=oy5sh1sxkQ3VgiNh1lkFRDokuHv8lxStuDThqhbPmtDgwlz+tCJ42mzmN67CYYI+BY HjpTmUiFcjQtEufMiCRj8cpxHRlS8fydZ4sdTUIPwY6Mltq7JeCeIhWc57j3jWI3hi8q tbMBQt0toI6Tgmcllc29lF/Ph2m5u1x4nVNY7jbvclyaKlX0Z1FboWG7iYyxesW07BXf vz7QBdaEl2x7V1WnTEyk+x/AYc+Wc8fdLziBr86ucN/A22/lHCUn0TPFZIecjKfyp1So Lpcxlz8z7lnAcBgr+desHW+ditlGEo+RzKmql/CrL6lPwno3sqCQYcSHtlXo6bAYmnax JWQw==
- In-reply-to: <20130726203931.3e05f151@pws-pc.ntlworld.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>
- Mail-followup-to: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>, zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20130726134811.GA14136@chaz.gmail.com> <20130726203931.3e05f151@pws-pc.ntlworld.com>
2013-07-26 20:39:31 +0100, Peter Stephenson:
> On Fri, 26 Jul 2013 14:48:11 +0100
> Stephane Chazelas <stephane.chazelas@xxxxxxxxx> wrote:
> > recently, Debian broke some of my scripts using ZLE in `zsh -i` by adding:
> >
> > function zle-line-init () {
> > emulate -L zsh
> > printf '%s' ${terminfo[smkx]}
> > }
> >
> > To /etc/zsh/zshrc
> >
> > That smkx escape sequence is printed to stdout instead of the terminal.
>
> It's just occurred to me that maybe zle special functions should be run
> with stdout and stdin set explicitly to the terminal. Arguably they
> have no business knowing about a redirected stdout or stdin since they
> run in a context where that's meaningless. stderr would be good enough
> for debugging.
[...]
In my script (http://www.zsh.org/mla/users/2007/msg01187.html),
I need to be able to access stdout from a zle function, though I
could change it to use another fd (my modified "accept-line"
writes the $BUFFER to stdout that goes to a pipe) (and yes,
there was a reason to write it in such a convoluted way, but
that was years ago)
Given that ZLE can be used from "vared" to implement a line
editor for something else than the shell prompt, where a system
of functions can be defined by the user, it feels wrong to hide
stdout from those functions.
Think of
vared var | {
some processing that interacts with what widgets write to
stdout
}
Now, I agree it's a clean way to expose the terminal to the ZLE
widgets would they need to send/recv data to/from it, and one
can dup to another fd if they need to access the original
stdin/out.
vared var 3>&1 | ...
or use a coproc...
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author