Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: print to the terminal in zle



2013-07-26 19:36:46 +0200, Frank Terbeck:
> Hey Stephane,
> 
> Stephane Chazelas wrote:
> > recently, Debian broke some of my scripts using ZLE in `zsh -i` by adding:
> 
> An interactive shell for a script? What's the reason for that?

See http://www.zsh.org/mla/users/2007/msg01187.html

The idea is just to use the zsh line editor in an application of
mine (there a wrapper around mairix (a mail indexer) to provide
with an intelligent prompt (with completion) for mutt).


> 
> >         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.
> 
> Which terminal is that? The terminal should definitely react to smkx if
> it has that sequence in its terminfo database entry. Are you maybe
> changing $TERM to something the terminal cannot handle?

The problem is not with the terminal, but with that code sending
the escape sequence to stdout (which doesn't have to be the
terminal, in my case, it's a pipe and I don't want to get that
smkx escape there (that's what breaking my script), instead of
the terminal

> If not, what are you doing that uses zle and is not connected to a
> terminal?

zle is connected to a terminal, not via stdout, zle doesn't use
stdout for display and should not which is the whole point of
this thread.

I was just asking if there was a way for a zle function to
output something to the terminal via the file descriptor that
zsh keeps to the terminal (which is not stdout).

Peter clearly answered the question in his first reply.

-- 
Stephane



Messages sorted by: Reverse Date, Date, Thread, Author