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

Re: Using zle outside zsh



On Tue, 24 Aug 2004, DervishD wrote:

> >  So pick the last line out of $response and
> > pass that to vared as the prompt, like so:
> > pmpt=${response##$'*\n'}
> 
>     I must use "${response##*$'\n'}" or it doesn't work because the
> '*' is quoted

Oh, yes.  Typo on my part.  Sorry.

> but otherwise it works perfectly. Is there a way of
> making 'vared' not to print a carriage return?

Not really.  'setopt nopromptcr' works initially, but the first time ZLE 
decides to redraw the whole line or minimize the number of characters used 
for a backwards motion, it emits a \r and then things get pretty garbled.  
(Maybe Wayne will see this and fix something.)

>     OTOH, I think that, for a program like 'ftp' that not only prints
> its own set of prompts but uses some server responses as prompts, it
> would be better to read line by line until no more lines are present

Unfortunately there's no way to know *when* "no more lines are present". 
It's a TTY, after all; you don't get an EOF.

>     Seems that the only possible solutions is to know in advance all
> possible prompts and use 'zpty -r COMMAND NAME PATTERN', or using
> zselect, or even using a proxy program that translates and normalizes
> all received prompts including a '\n', or something like that...

zselect might help, because you could look for input from the keyboard
and from the pty at the same time -- but then you can't use vared.

Or you could try something with "zle -F" but I don't know if that works
inside vared (I'd presume it does, but I've never tried).



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