zsh-workers
 help / color / mirror / code / Atom feed
* Re: vared -h question
       [not found] <E121cqJ-0002yP-00.1999-12-24-22-05-47@cmailg5.svr.pol.co.uk>
@ 1999-12-29 20:40 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 1999-12-29 20:40 UTC (permalink / raw)
  To: Zsh hackers list

(Accessing previous lines entered with vared in a loop):

Peter Stephenson wrote:
> The answer should be to stick `print -s $cmd' as the first command inside
> the loop, as well as adding the -h flag to vared.  Embarassingly (at least
> in the latest 3.1.6++), that doesn't work properly because you don't get
> the most recent command in the history, though you do get the second most
> recent --- i.e. the third time round the while-loop you'll be able to
> re-edit what you entered on the first.

This doesn't look very nice to fix (heard that before?).  The basic problem
is that history isn't active, so the `current' history line is the one
before, which isn't usually used for history.  The choices I've thought of
so far include:

- Some hack-up in zleread() to add a bogus `current' history line, then
delete it at the end.  Yuck.
- Turn on the history mechanism if it isn't already.  That would in
principal get the line automatically entered into the history list, which
is logically consistent.  However, I tentatively tried inserting an
hbegin()/hend() into zleread() under these circumstances and it crashed
in remember_edits() because the entry had nulls in it, so this would need
more work.  How much more work isn't clear because the history code and the
editing code have never been well integrated and have gathered separate
encrustations.
- Let someone else fix it.

I'm still inclining to the third possibility, but I'll keep thinking about
it, too.

-- 
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* vared -h question
@ 1999-12-24 17:56 Greg Klanderman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Klanderman @ 1999-12-24 17:56 UTC (permalink / raw)
  To: Zsh list


Hi,

I'm trying to use vared to implement a simple read/eval/print loop:

while cmd="" && vared -p "cmd: " cmd ; do
  ## send cmd to server on host:port and print result
done

I'd like to have history work, and if I use the -h flag I can access
the shell's history, but vared does not store the history of my
entered commands into the shell history it seems.  So it's a bit
useless.  Is there any way to do what I want, ie add a line into 
the history?

thanks and happy holidays,
Greg


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-12-30 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <E121cqJ-0002yP-00.1999-12-24-22-05-47@cmailg5.svr.pol.co.uk>
1999-12-29 20:40 ` vared -h question Peter Stephenson
1999-12-24 17:56 Greg Klanderman

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).