From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2594 invoked from network); 30 Dec 1999 18:37:10 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 30 Dec 1999 18:37:10 -0000 Received: (qmail 984 invoked by alias); 30 Dec 1999 18:37:04 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9171 Received: (qmail 977 invoked from network); 30 Dec 1999 18:37:04 -0000 To: zsh-workers@sunsite.auc.dk (Zsh hackers list) Subject: Re: vared -h question In-reply-to: "Peter Stephenson"'s message of "Fri, 24 Dec 1999 22:07:03 GMT." Date: Wed, 29 Dec 1999 20:40:05 +0000 From: Peter Stephenson Message-Id: (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