Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Using zle outside zsh
- X-seq: zsh-users 7923
- From: DervishD <disposable1@xxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Using zle outside zsh
- Date: Tue, 24 Aug 2004 21:32:12 +0200
- In-reply-to: <Pine.LNX.4.61.0408241153360.10235@xxxxxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: Pleyades
- References: <20040823155951.GA24279@DervishD> <Pine.LNX.4.61.0408231018430.5997@xxxxxxxxxxxxxxxxxx> <20040823194613.GA25072@DervishD> <Pine.LNX.4.61.0408231436340.3917@xxxxxxxxxxxxxxxxxx> <20040824093921.GA25290@DervishD> <Pine.LNX.4.61.0408240747380.5806@xxxxxxxxxxxxxxxxxx> <20040824170545.GA28326@DervishD> <Pine.LNX.4.61.0408241153360.10235@xxxxxxxxxxxxxxxxxx>
Hi Bart :)
* Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> dixit:
> > > 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.
Don't worry. My mistakes weren't typos O:)
> > 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.
Yes, but I can use 'zpty -rt' to test if more output must be
copied. The problem with this method is that it won't read the prompt
line since it doesn't have a '\n' at the end, it's not a line!. If
the prompt was always the same, it wouldn't be a problem, but...
It works as it is now, and the only problem is to get all the
prompts. It is a work far less complex than to write a line editor
for the ftp client ;)
> > 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.
I prefer to use vared by now, although I can change all
keybindings for this particular use inside the script and get rid of
vared. My version of zsh doesn't even have 'zselect', so...
> 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).
My zsh version (4.0.9) doesn't seem to have '-F' as an option to
zle. I'll take a look in the 4.2.1 I haven't installed yet.
Well, thanks a lot for all your help, Bart :) Now I have an
alternative to zftp with full command line editing... as soon as I do
a bit of work. Not much, fortunately :) Thanks
Raúl Núñez de Arenas Coronado
--
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author